Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Stacked column chart - help

Hi, 

 

I have tried to look up for it in the internet but couldnt find any answers that would give me answers to my problem so I am posting here. 

 

I am trying to create a stacked column chart visualisation but I dont know if I put the wrong information in the wrong field or if I need to "transform" my data further to accommodate the visualisation. 

 

This is what I could create so far: 

This is what I want, but I want to do this for multiple categories which would mean the same format of column like this but multiple times showing the different categories. 

 

I would like the visualisation to be a stacked column charts with those different categories: 

White belt : Beginner, Advanced beginner, Competent, Proficient, Expert (one stacked column)

Yellow belt:  Beginner, Advanced beginner, Competent, Proficient, Expert (one stacked column)

Green belt:  Beginner, Advanced beginner, Competent, Proficient, Expert (one stacked column) 

Black belt: Beginner, Advanced beginner, Competent, Proficient, Expert (one stacked column) 

 

And all these categories represented in one graph. This is where I am stuck when I try to put more than one category, the data is not visualised as I want. 

 

I would greatly appreciate some help on this.

 

 

 

  • Hi Anonymous ,

     

    Please try:

    First, Unpivot your columns:

    Output:

    Here is the M code:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tVRLDsIgEL1Kw5pLqHFr3JMukI6GpAIhjfH4xphYfgMIdTfD/B7vMTBGjk8DdiF0Nc5WX6WQoN7OHm5SKbBkpMyPHPTdwPKxd9ODKwHT8E0PKt1krws+LAYWGhEkFB+K5aTVwI2ZpeCXGZCbBElhjxIRiXIcdSX5uNMJtp6p0sE/qE4BTRbh0eq56X3wnLhTJJQzo0h3u8K5OM2psMWiFe+1yRfzw0I5qegngBV0atNd0/TaMwqu/TpFbP5EnPNKDrItEYnGFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Lean six sigma white belt" = _t, #"Lean six sigma yllow belt" = _t, #"Lean sik sigma green belt" = _t, #"Lean six sigma black belt" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Lean six sigma white belt", type text}, {"Lean six sigma yllow belt", type text}, {"Lean sik sigma green belt", type text}, {"Lean six sigma black belt", type text}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
    in
        #"Unpivoted Columns"

    Then apply it to the chart:

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • Hello 

    You can add Belt field in X Axis 

    Y axis would be your Value Column 

    and you can add column with these values (Beginner, Advanced beginner, Competent, Proficient, Expert ) in Legend

    • Anonymous's avatar
      Anonymous
      Not applicable

      JadhavVarsha_13  thank you for your response. 

       

      Above is my data -  do I have to create / change anything ? 

       

      This is what I do to get the one column shown in my first post 

       

  • Hi Anonymous ,

     

    Please try:

    First, Unpivot your columns:

    Output:

    Here is the M code:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tVRLDsIgEL1Kw5pLqHFr3JMukI6GpAIhjfH4xphYfgMIdTfD/B7vMTBGjk8DdiF0Nc5WX6WQoN7OHm5SKbBkpMyPHPTdwPKxd9ODKwHT8E0PKt1krws+LAYWGhEkFB+K5aTVwI2ZpeCXGZCbBElhjxIRiXIcdSX5uNMJtp6p0sE/qE4BTRbh0eq56X3wnLhTJJQzo0h3u8K5OM2psMWiFe+1yRfzw0I5qegngBV0atNd0/TaMwqu/TpFbP5EnPNKDrItEYnGFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Lean six sigma white belt" = _t, #"Lean six sigma yllow belt" = _t, #"Lean sik sigma green belt" = _t, #"Lean six sigma black belt" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Lean six sigma white belt", type text}, {"Lean six sigma yllow belt", type text}, {"Lean sik sigma green belt", type text}, {"Lean six sigma black belt", type text}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
    in
        #"Unpivoted Columns"

    Then apply it to the chart:

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much, it works !