This proved to be a challenging one, mainly because the data wasnât only stacked vertically across rows but also repeated horizontally across columns.
Since the number of rows wasnât distributed evenly, I removed âall blank rowsâ.
To be able to identify the Lists that belong together - (A) added an Index, (B) extracted the first value from the List object and if that was a date (C ) return the value from [Index] and Fill Down.
Now to bring them back together a very special Group By (kudos to Imke Feldmann): Table.Group(#âFilled Downâ, {âIndex2â}, {{âPartitionâ, each Table.FromColumns(_[Column1]), type table [Column1=list, Index2=number]}})
Agreed - this is amazing. From @AllisterBâs initial description, I thought âthis doesnât sound too hardâ. Then, I opened the file and was like âwhoa, nopeâ. Thanks for posting such detailed solutions and clear explanations - these are like daily mini tutorials on PQ/M and Iâve learned a ton from them. Great stuff!
Hi @AllisterB, a response on this post has been tagged as âSolutionâ. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!"
Thank You so much for your fantastic solution - nice work.
I have implemented it for one instance. I now need to use it for 6 workbooks in one folder. They all have the same structure.
I tried replacing the source code in your solution with code that combines data from all the workbooks . the code is attached and it doesnât work as iI get this error
âExpression.Error: The name âSample Fileâ wasnât recognized. Make sure itâs spelled correctly.â
Updated the Excel file for the FromFolder option. It references Tables named Table1, so check that.
Just update the FileFolderLocation Parameter and the Queries should restore.
Well the error occurs when the Custom Function is called, so you actually need to step through that Query to see where the error occurs⌠Can you do that and let me know?
In theTransform File Query there is only 1 applied step. When I go to teh editor I see 20 or so rows of code - how to I step through these to find where the error is
If that isnât visible on your screen go to the File menu: Options and Settings / Query Options / Power Query Editor => and toggle on the âDisplay the Query settings paneâ
Start on the top and work your way down, so click on each Name and when you encounter an Error make sure to include a screen print of the preview pane as well
What do you see in the preview pane? Thatâs the center of your screen.
In this case also a view of the preview pane of the previous step will be helpful - thanks
I have attached eth code - the line in you last post is the second row
I expanded the Data column and that just gave me the columns from the data Worksheet. The screen showing Dat Item Kind eg is not showing - do I need to do anything to make it show
I need to see the preview pane for the Source step, as I tried to explain the combination of (1) and (2) result in getting the Data at position (3). So if Kind <> Table or the Item <> Table1 - youâll get that error
If the only columns you have in the Source step are depicted in post #16 than see what happens if you manually add a New Source/File/Folder, select the Parameter when asked for the Folder path and choose Combine and Transform data, you will get a screen like this.