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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.