Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi Experts,
How can we achieve below pivoting in Power Query or close to this?
Please help?
| User | Category | Template ID | Title | Document ID | ||
| 1 | AX | 10 | AA | 94237 | ||
| 1 | AX | 10 | AB | 94237 | ||
| 1 | AX | 10 | AC | 94237 | ||
| 2 | AX | 10 | AA | 94000 | ||
| Output | ||||||
| User | Category | Template ID | Title1 | Title2 | Title3 | Document ID |
| 1 | AX | 10 | AA | AB | AC | 94237 |
| 2 | AX | 10 | AA | 94200 |
Solved! Go to Solution.
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:
Result:
I hope this will help you.
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:
Result:
I hope this will help you.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 68 | |
| 59 | |
| 44 | |
| 20 | |
| 15 |