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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pgd
Frequent Visitor

How to create clustered column chart with different legend?

I have tabular excel data. I have wage rate (20, 25, 30, 35, and 40) in one column and <1, <2, <3, >=3 as columns. The wage rate repeats per division code. So division 1 has 20, 25, 30, 35, and 40 in cells 1-5. Division code 2 has 20, 25, 30, 35, and 40 in cells 6-10, etc. Please see below for reference. 

 

Capture.PNG

 

How do I plot the costs (<1, <2, <3, >=3) on the x axis where the legend corresponds to the wage rate (20, 25, 30, 35, 40)?

 

I want it to look the graph below. Instead of Central, South, East, and West, I'm trying to do <1, <2, <3, and >=3. Instead of furniture, office supplies, and technology, I'm trying to do the wage rates. 

Capture.PNG

Do you know how I can do this? For some reason, I haven't been able to add wage to the legend field. 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @pgd ,

 

Please try:

Unpivot columns:

vjianbolimsft_0-1675736253318.png

Here is the M code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VY6xEcAwCAN3ce0iYAzxLLnsv0aQLsGXRoUeCV1X06P1JpA5U0xShsFrd08MUxUSwAM4Cg8Gcc7Dk7I2Zppt6F2eErvcmIYp1cuK9zdwwFxScqJxT5t4pqsqtDCnOdIOU+Kf5jTnIIgjbbMwp5l9ewNBeonvBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Wage Rate" = _t, #"<1" = _t, #"<2" = _t, #"<3" = _t, #">=3" = _t, Division = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Wage Rate", Int64.Type}, {"<1", Int64.Type}, {"<2", Int64.Type}, {"<3", Int64.Type}, {">=3", Int64.Type}, {"Division", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Wage Rate", "Division"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

 

Then creaete the visual:

vjianbolimsft_1-1675736346682.png

Final output:

vjianbolimsft_2-1675736363045.png

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.

View solution in original post

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @pgd ,

 

Please try:

Unpivot columns:

vjianbolimsft_0-1675736253318.png

Here is the M code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VY6xEcAwCAN3ce0iYAzxLLnsv0aQLsGXRoUeCV1X06P1JpA5U0xShsFrd08MUxUSwAM4Cg8Gcc7Dk7I2Zppt6F2eErvcmIYp1cuK9zdwwFxScqJxT5t4pqsqtDCnOdIOU+Kf5jTnIIgjbbMwp5l9ewNBeonvBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Wage Rate" = _t, #"<1" = _t, #"<2" = _t, #"<3" = _t, #">=3" = _t, Division = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Wage Rate", Int64.Type}, {"<1", Int64.Type}, {"<2", Int64.Type}, {"<3", Int64.Type}, {">=3", Int64.Type}, {"Division", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Wage Rate", "Division"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

 

Then creaete the visual:

vjianbolimsft_1-1675736346682.png

Final output:

vjianbolimsft_2-1675736363045.png

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.

@v-jianboli-msft  Thank you very much! This is exactly what I was looking for. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.