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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
thmonte
Helper IV
Helper IV

Properly unpivitoing columns for a dataset

If I have a dataset that looks like the following:

 

person

Attrib1Attrib2Attribute3Attrib1ValueAttrib2ValueAttrib3Value
JohnEyesFingersNose251
LouEyesFingersNose201

 

How do I turn it into something like this

 

nameattribamount
JohnEyes2
JohnFingers5
JohnNose1
LouEyes2
LouNose1

 

Typically when i research this issue the resolution is to always create multiple queries for each column pair and then append them to each other but to me thats the least pefromance friendly way as I have to load thousands of rows on a refresh and all these queires fill up my editor.

1 ACCEPTED SOLUTION

@v-eachen-msft  thank you for the response but i acheived the same thing using this other solution found here:

 

https://community.powerbi.com/t5/Desktop/Unpivot-Multiple-Coumns/td-p/442606

 

However, I'm not sure which is more performance friendly..

View solution in original post

5 REPLIES 5
v-eachen-msft
Community Support
Community Support

Hi @thmonte ,

 

You can follow these steps:

1. You need to replace "Attribute3" with "Attrib3".

2. Unpivot "Attrib1","Attrib2","Attrib3" columns.

3. After it, unpivot "Attrib1Value","Attrib2Value","Attrib3Value" columns.

4. Then, replace "Value" with "".

5. Open Advanced Editor, add an m query:

#"Remove Rows" = Table.SelectRows(#"Replaced Value",each ([Attribute]=[Attribute.1]) and ([Value.1]<>"0"))

6. Remove "Attribute" and "Attribute1" columns.

Here is the result.

3-1.PNG

You can download my test file from the link.
 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-eachen-msft  thank you for the response but i acheived the same thing using this other solution found here:

 

https://community.powerbi.com/t5/Desktop/Unpivot-Multiple-Coumns/td-p/442606

 

However, I'm not sure which is more performance friendly..

Hi @thmonte ,

 

I don't think there is any difference in performance. You can pick a method that is easier for you to understand.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
PattemManohar
Community Champion
Community Champion

@thmonte  Could you please confirm - Is the number of attribute columns (in this example, which are three attributes) is constant or it will also change dynamically ?





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




It's constant. In my case it's always 8 columns for each

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors