Forum Discussion

ribisht17's avatar
ribisht17
Super User
3 years ago
Solved

Unpivot multiple columns

How to convert from yellow to blue with Transformation Ribbon (With Power Query I could)

 

 

You can find data-source here at sheet 3 > Multiple Level Unpivoting.xlsx (sharepoint.com)

 

Regards,

Ritesh

4 Replies

  • ribisht17 Try this code in a blank query of power query

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIyBhJ+IJahgQGQjEwthpN++UqxOtFKTiBJmCpTU+yKnIFMMzMgYQJSYGGOpgpExsYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [EMP = _t, #"Power BI Score" = _t, #"Sigma Score" = _t, #"Tableau Score" = _t, #"Tableau Certification" = _t, #"Power BI Certification" = _t, #"Sigma Certification" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"EMP", type text}, {"Power BI Score", Int64.Type}, {"Sigma Score", type text}, {"Tableau Score", Int64.Type}, {"Tableau Certification", type text}, {"Power BI Certification", type text}, {"Sigma Certification", type text}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"EMP"}, "Attribute", "Value"),
        #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Attribute.1", "Attribute.2"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", type text}, {"Attribute.2", type text}}),
        #"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Attribute.2]), "Attribute.2", "Value")
    in
        #"Pivoted Column"
  • amitchandak 

     

    Thanks Amit, Can you share the pbix file with me ?

     

    Are you getting the above desired output with this code ?

     

    I wanted to do this with transformation ribbon not Power Query , I did try to follow your code but could not get the desired output

     

    Regards,

    Ritesh