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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
abgnfirdaus
Helper I
Helper I

unpivot multiple time

Hello there, I need help here. Is it possible to unpivot column multiple time. for example:

Date TestedEquipmentRed cable ABlue cable AYellow cable ARed cable BRed cable BYellow cable B
2018TRU 10.230.450.65111
2019TRU 10.250.480.69222
2020TRU 10.280.50.71333
2018TRU 20.320.50.7444
2019TRU 20.350.530.74555
2020TRU 20.380.580.78666

 

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.

1 REPLY 1
amitchandak
Super User
Super User

@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"
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.