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
Anonymous
Not applicable

Clustered Bar Chart Sorting

Hi All, 

 

I'm trying to sort the clustered bar chart based with below sample dataset in Power Bi, 

Customer GroupSales 
AAA500
ABA50
ACA200
ADA2000
BBB1000
BQB500
BAB400

 

The original chart available in Power Bi will be looking like this, and only limited sorting options are available (by Sales / by Customers' name alphabetically. 

 

**I generated similar output by using excel

image.png

 

I'm trying to achieve sorting like below. Sort the sales in descending orders within each customer groups. Couldn't find any solutions through online so far, appreaciate that if someone could help to advice on this. 

image.png

Thanks in advance! 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

Add a calculated column to above sample dataset.

Rank Col =
COUNTROWS (
    FILTER (
        Test_9,
        Test_9[Sales ] <= EARLIER ( Test_9[Sales ] )
            && Test_9[Group] = EARLIER ( Test_9[Group] )
    )
)

1.PNG

 

Choose [Customer] field, click "Sort by Column", choose "Rank Col" from the list.

2.PNG

 

Chart preview.

3.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

Add a calculated column to above sample dataset.

Rank Col =
COUNTROWS (
    FILTER (
        Test_9,
        Test_9[Sales ] <= EARLIER ( Test_9[Sales ] )
            && Test_9[Group] = EARLIER ( Test_9[Group] )
    )
)

1.PNG

 

Choose [Customer] field, click "Sort by Column", choose "Rank Col" from the list.

2.PNG

 

Chart preview.

3.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks a lot for the recommendations. It's a good idea but unfortunately it won't work for my case as the "Sales" is a measures. 

ajayemmadi1
Helper I
Helper I

Hi JOO13,

 

You can create a condtitional column (Sort_Order). For example in your case 
AD =1

AA =2

AC =3

AB =4

BB =5

BQ =6

BA =7

Create a condtional column as per the above format and then do sorting of Customer with respect to Sort_Order Column. I hope your issue will be resolved using this approach.

 

Anonymous
Not applicable

Thanks for the recommendations. It's a good idea but unfortunately it won't work for my case as "Sales" is a Measure. 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.