Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello there, I need help here. Is it possible to unpivot column multiple time. for example:
Date Tested | Equipment | Red cable A | Blue cable A | Yellow cable A | Red cable B | Red cable B | Yellow cable B |
2018 | TRU 1 | 0.23 | 0.45 | 0.65 | 1 | 1 | 1 |
2019 | TRU 1 | 0.25 | 0.48 | 0.69 | 2 | 2 | 2 |
2020 | TRU 1 | 0.28 | 0.5 | 0.71 | 3 | 3 | 3 |
2018 | TRU 2 | 0.32 | 0.5 | 0.7 | 4 | 4 | 4 |
2019 | TRU 2 | 0.35 | 0.53 | 0.74 | 5 | 5 | 5 |
2020 | TRU 2 | 0.38 | 0.58 | 0.78 | 6 | 6 | 6 |
I want to combine Red cable A, blue cable A and yellow cable A in one slicer. Then, I want to combine red cable B, yellow cable B and blue cable B in another slicer. I found that it is impossible to unpivot again for Cables B after I unpivot for Cable A.
Hope you guys can guide me on how to solve this matter. Thank you.
@abgnfirdaus , Try if this can help
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XY/LDYAgEERbMZyJgeVrG0ZPhP7bkN3BjXgYJpH3wtiaIeerseY6782PdjsFqZikMpfXdCvGsRpAY4XBl6SBQW41gMIr/C1o5hPvKBIm0FcYZ9T8Jk0eZMK/FCaT5jdpGnMSqnBlTe8P", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date Tested" = _t, Equipment = _t, #"Red cable A" = _t, #"Blue cable A" = _t, #"Yellow cable A" = _t, #"Red cable B" = _t, #"Blue cable B" = _t, #"Yellow cable B" = _t]),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Date Tested", "Equipment"}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Attribute.1", "Attribute.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Date Tested", Int64.Type}, {"Equipment", type text}, {"Attribute.1", type text}, {"Attribute.2", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Attribute.2]), "Attribute.2", "Value", List.Max),
#"Added Custom" = Table.AddColumn(#"Pivoted Column", "A.1", each [Attribute.1] & " A"),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "B.1", each [Attribute.1] & " B")
in
#"Added Custom1"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |