# Tags **Software** : [[02 - Tags/Software/Power Query]] **Functions** used : [[Excel.CurrentWorkbook]] [[Table.FirstN]] [[Table.ToColumns]] [[List.Transform]] [[Text.Combine]] [[Record.FromList]] [[Table.ColumnNames]] [[Table.Skip]] [[Table.PromoteHeaders]] **Date** : 21-March-2025 # Description 🌐 Follow along step-by-step as we demystify the process. Uncover the magic behind the reusable function, and by the end, you'll wield a tool that goes beyond this tutorial - ready to enhance your projects in ways you never thought possible! # Video Link <iframe width="560" height="315" src="https://www.youtube.com/embed/QBhG8m-zio0?si=ZaDJHP9Tb9-uJePj" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> [GITHUB File Link](https://github.com/jbotes/powerbiTutorials/blob/main/PQ_Double_Headers_YT_Video.xlsx) # M-Query ```Query 1 - Function (inputtable as table, rowsheader as number) => let Source = inputtable, Header = Table.FirstN(Source,rowsheader), HeaderList = Table.ToColumns(Header), HeaderConcat = List.Transform(HeaderList , each Text.Combine((_), "|")), HeaderAsRecord = Record.FromList(HeaderConcat, Table.ColumnNames(Source)), SkipHeaderRows = Table.Skip(Source,rowsheader), Custom1 = Table.PromoteHeaders(Table.InsertRows(SkipHeaderRows, 0, {HeaderAsRecord})) in Custom1 ``` ``` Query 2 let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], Header = Table.FirstN(Source,2), HeaderList = Table.ToColumns(Header), HeaderConcat = List.Transform(HeaderList , each Text.Combine((_), "|")), HeaderAsRecord = Record.FromList(HeaderConcat, Table.ColumnNames(Source)), SkipHeaderRows = Table.Skip(Source,2), Custom1 = Table.PromoteHeaders(Table.InsertRows(SkipHeaderRows, 0, {HeaderAsRecord})) in Custom1 ``` ## Optional Tags **Tags** : **Technique** : [[Custom Function]]