Forum Discussion
Combine excel files with different columns structure in Power Query
Hi,
I want to combine excel files in Power Query. I need to pull from each file two rows Revenue and Category. Each file has different categories. Is it possible to tranform the table in this way?
10 Replies
- slorin
Super User
Hi,
another solution : Unpivot + Pivot
let
Source = Your_Source,
Unpivot = Table.UnpivotOtherColumns(Source, {"Source", "Type"}, "Attribute", "Value"),
Pivot = Table.Pivot(Unpivot, List.Distinct(Unpivot[Type]), "Type", "Value")
in
PivotStéphane
- Qasim_JanFrequent Visitor
Hi slorin
I select "Source" and" Type" column and Unpivot other columns which results in "Attribute" and "Value" column. Now when I select "Type" column--> Transform-->Pivot Column-->selelct "Value"-->"Don't Aggregate-->OK, it works. But if I remove "Attribute" column and then try Pivot, it result in error. When I peek into the error, it says something like this " Expression.Error: There were too many elements in the enumeration to complete the operation.
Details:
[List] "
Can you please elaborate on this error.
Thanks
- Qasim_JanFrequent Visitor
Hi@AlienX
Is this doable in PQ UI. If not can you explain the code, please.
Thanks
- slorin
Super User
remove "Attribute" column after pivot, not before