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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Clustered bar chart, clustered in order of size

Hi,

 

Is there a way to order each of the clusters by size for each month?

 

Capture.PNG

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check if this could meet your requirements.

rank.jpg

 

1. Enter data to create a Rank Table.

ranktable.PNG

 

2. Create measures.

Measure = 
VAR A_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "A" )
VAR B_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "B" )
VAR C_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "C" )
VAR D_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "D" )
VAR M1 =
    UNION (
        ROW ( "Value", A_, "Category", "A" ),
        ROW ( "Value", B_, "Category", "B" ),
        ROW ( "Value", C_, "Category", "C" ),
        ROW ( "Value", D_, "Category", "D" )
    )
VAR Result1 =
    MAXX ( M1, [Value] )
VAR Result2 =
    MINX ( TOPN ( 2, M1, [Value] ), [Value] )
VAR Result3 =
    MINX ( TOPN ( 3, M1, [Value] ), [Value] )
VAR Result4 =
    MINX ( M1, [Value] )
RETURN
    SWITCH (
        MAX ( 'Rank Table'[Rank] ),
        "1st", Result1,
        "2nd", Result2,
        "3rd", Result3,
        "4th", Result4
    )
Measure Tooltip = 
VAR A_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "A" )
VAR B_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "B" )
VAR C_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "C" )
VAR D_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "D" )
VAR M1 =
    UNION (
        ROW ( "Value", A_, "Category", "A" ),
        ROW ( "Value", B_, "Category", "B" ),
        ROW ( "Value", C_, "Category", "C" ),
        ROW ( "Value", D_, "Category", "D" )
    )
VAR Result1 =
    MAXX ( M1, [Value] )
VAR Result2 =
    MINX ( TOPN ( 2, M1, [Value] ), [Value] )
VAR Result3 =
    MINX ( TOPN ( 3, M1, [Value] ), [Value] )
VAR Result4 =
    MINX ( M1, [Value] )
VAR Tooltip1 =
    MAXX ( FILTER ( M1, [Value] = Result1 ), [Category] )
VAR Tooltip2 =
    MAXX ( FILTER ( M1, [Value] = Result2 ), [Category] )
VAR Tooltip3 =
    MAXX ( FILTER ( M1, [Value] = Result3 ), [Category] )
VAR Tooltip4 =
    MAXX ( FILTER ( M1, [Value] = Result4 ), [Category] )
RETURN
    SWITCH (
        MAX ( 'Rank Table'[Rank] ),
        "1st", Tooltip1,
        "2nd", Tooltip2,
        "3rd", Tooltip3,
        "4th", Tooltip4
    )

 

3. Create a Clustered column chart like so:

bar.PNG

 

Then, you can get this:

bar chart.gif

 

BTW, .pbix file attached.

 

 

Best Regards,

Icey

 

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
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check if this could meet your requirements.

rank.jpg

 

1. Enter data to create a Rank Table.

ranktable.PNG

 

2. Create measures.

Measure = 
VAR A_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "A" )
VAR B_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "B" )
VAR C_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "C" )
VAR D_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "D" )
VAR M1 =
    UNION (
        ROW ( "Value", A_, "Category", "A" ),
        ROW ( "Value", B_, "Category", "B" ),
        ROW ( "Value", C_, "Category", "C" ),
        ROW ( "Value", D_, "Category", "D" )
    )
VAR Result1 =
    MAXX ( M1, [Value] )
VAR Result2 =
    MINX ( TOPN ( 2, M1, [Value] ), [Value] )
VAR Result3 =
    MINX ( TOPN ( 3, M1, [Value] ), [Value] )
VAR Result4 =
    MINX ( M1, [Value] )
RETURN
    SWITCH (
        MAX ( 'Rank Table'[Rank] ),
        "1st", Result1,
        "2nd", Result2,
        "3rd", Result3,
        "4th", Result4
    )
Measure Tooltip = 
VAR A_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "A" )
VAR B_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "B" )
VAR C_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "C" )
VAR D_ =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Category] = "D" )
VAR M1 =
    UNION (
        ROW ( "Value", A_, "Category", "A" ),
        ROW ( "Value", B_, "Category", "B" ),
        ROW ( "Value", C_, "Category", "C" ),
        ROW ( "Value", D_, "Category", "D" )
    )
VAR Result1 =
    MAXX ( M1, [Value] )
VAR Result2 =
    MINX ( TOPN ( 2, M1, [Value] ), [Value] )
VAR Result3 =
    MINX ( TOPN ( 3, M1, [Value] ), [Value] )
VAR Result4 =
    MINX ( M1, [Value] )
VAR Tooltip1 =
    MAXX ( FILTER ( M1, [Value] = Result1 ), [Category] )
VAR Tooltip2 =
    MAXX ( FILTER ( M1, [Value] = Result2 ), [Category] )
VAR Tooltip3 =
    MAXX ( FILTER ( M1, [Value] = Result3 ), [Category] )
VAR Tooltip4 =
    MAXX ( FILTER ( M1, [Value] = Result4 ), [Category] )
RETURN
    SWITCH (
        MAX ( 'Rank Table'[Rank] ),
        "1st", Tooltip1,
        "2nd", Tooltip2,
        "3rd", Tooltip3,
        "4th", Tooltip4
    )

 

3. Create a Clustered column chart like so:

bar.PNG

 

Then, you can get this:

bar chart.gif

 

BTW, .pbix file attached.

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

@Anonymous , I did see any option to to do that. Even tried sort on value measure . but seem like internal  sorting there is no option

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors