# Tags **Software** : [[02 - Tags/Software/Power Query]] **Functions** used : [[Table.FromList]] [[List.Transform]] [[Table.ToColumns]] [[List.RemoveNulls]] [[Table.AddColumn]] [[List.IsEmpty]] [[Table.Group]] [[Table.PromoteHeaders]] [[Table.Combine]] [[Excel.Workbook]] **Date** : 16-March-2025 # Description You might encounter scenarios where your datasets (especially from pdfs) appear horizontally next to each other separated by variable number of blank columns 💀🦙 in this tutorial i show you how to unstack these datasets. # Video Link <iframe width="560" height="315" src="https://www.youtube.com/embed/rBrnT9jbeo0?si=1IM4kJLc0zx80BMr" 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_HorzontalStack_Video.xlsx) [Source File GITHUB Link](https://github.com/jbotes/powerbiTutorials/blob/main/HorizontalDatasheet.xlsx) # M-Query ```mquery let Source = Excel.Workbook(File.Contents("C:\test\Pq Tutorials\HorizontalDatasheet.xlsx"), null, true), Sheet2_Sheet = Source{[Item="Sheet2",Kind="Sheet"]}[Data], Custom1 = Table.FromList(List.Transform(Table.ToColumns(Sheet2_Sheet), each List.RemoveNulls(_)), Splitter.SplitByNothing()), #"Added Custom" = Table.AddColumn(Custom1, "Custom", each List.IsEmpty([Column1])), Custom2 = Table.Group(#"Added Custom", "Custom", {"Stocks", each Table.PromoteHeaders(Table.FromColumns(_[Column1]))}, GroupKind.Local), #"Filtered Rows" = Table.Combine(Table.SelectRows(Custom2, each ([Custom] = false))[Stocks]) in #"Filtered Rows" ``` ## Optional Tags **Tags** : **Technique** : [[Stacking Lists]] [[Dynamic Grouping]] [[Inner Outer Tables]]