Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Tribal
Frequent Visitor

Transform data with Pivot function for multiple value columns

Hi,

 

In powerquery, I'm trying to pivot a table consisting of a single attribute column, with 6 value columns. I did find this post, and I've tried multiple ways to adapt it to my dataset. But it isn't giving me the desired result unfortunately: 

https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-How-to-transform-data-with-Pivot-f...

 

I would like to get the following result:

 

Tribal_0-1688029837375.png

 

But what happens with the solution provided in the linked post, is that the duplicate values of column 4 result in getting 10000+ columns. I also tried to manually adapt various parts of the custom function, but didn't seem to get the desired result. 

 

I hope someone has a suggestion how I can adapt the previously provided solution to work for this dataset, or has another suggestion. Thank you!

 

Best regards,

Arno

 

 

 

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi

3 steps :

- UnPivot "Value 1" to "Value 6"

- Combine Column 4 + Attribute 

- Pivot this new column with List.Sum

 

let
Source = YourSource,
UnPivot = Table.Unpivot(Source, {"Value 1", "Value 2", "Value 3", "Value 4", "Value 5", "Value 6"}, "Attribute", "Value"),
Combine = Table.CombineColumns(UnPivot,{"Column 4", "Attribute"},Combiner.CombineTextByDelimiter(".", QuoteStyle.None),"Attibute"),
Pivot = Table.Pivot(Combine, List.Distinct(Combine[Attibute]), "Attibute", "Value", List.Sum)
in
Pivot

 Stéphane

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Hi

3 steps :

- UnPivot "Value 1" to "Value 6"

- Combine Column 4 + Attribute 

- Pivot this new column with List.Sum

 

let
Source = YourSource,
UnPivot = Table.Unpivot(Source, {"Value 1", "Value 2", "Value 3", "Value 4", "Value 5", "Value 6"}, "Attribute", "Value"),
Combine = Table.CombineColumns(UnPivot,{"Column 4", "Attribute"},Combiner.CombineTextByDelimiter(".", QuoteStyle.None),"Attibute"),
Pivot = Table.Pivot(Combine, List.Distinct(Combine[Attibute]), "Attibute", "Value", List.Sum)
in
Pivot

 Stéphane

Tribal
Frequent Visitor

Hi Stéphane,

That works perfectly! Thank you so much for the quick reply. 

Have a great day!

 

Best regards,

Arno

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors