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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.