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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Pivot in Power Query

Hi Experts,

How can we achieve below pivoting in Power Query or close to this?

Please help?

 

UserCategoryTemplate IDTitleDocument ID  
1AX10AA94237  
1AX10AB94237  
1AX10AC94237  
2AX10AA94000  
Output      
       
UserCategoryTemplate IDTitle1Title2Title3Document ID
1AX10AAABAC94237
2AX10AA  94200
1 ACCEPTED SOLUTION
grandtotal
Resolver III
Resolver III

Try this one, copy to Advanced editor:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXKMABKGBiCWI5CwNDEyNleK1cGQdMIn6YwiaYTNWAMDA6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [User = _t, Category = _t, #"Template ID" = _t, Title = _t, #"Document ID" = _t]),
#"Duplicated Column1" = Table.DuplicateColumn(Source, "Title", "Title - Copy"),
#"Pivoted Column" = Table.Pivot(#"Duplicated Column1", List.Distinct(#"Duplicated Column1"[Title]), "Title", "Title - Copy")
in
#"Pivoted Column"

 

The trick is to duplicate Title column and then Pivot:

grandtotal_1-1670850130591.png

 

Result:

grandtotal_0-1670849916990.png

 

I hope this will help you.

View solution in original post

1 REPLY 1
grandtotal
Resolver III
Resolver III

Try this one, copy to Advanced editor:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXKMABKGBiCWI5CwNDEyNleK1cGQdMIn6YwiaYTNWAMDA6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [User = _t, Category = _t, #"Template ID" = _t, Title = _t, #"Document ID" = _t]),
#"Duplicated Column1" = Table.DuplicateColumn(Source, "Title", "Title - Copy"),
#"Pivoted Column" = Table.Pivot(#"Duplicated Column1", List.Distinct(#"Duplicated Column1"[Title]), "Title", "Title - Copy")
in
#"Pivoted Column"

 

The trick is to duplicate Title column and then Pivot:

grandtotal_1-1670850130591.png

 

Result:

grandtotal_0-1670849916990.png

 

I hope this will help you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.