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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Exanimis
Regular Visitor

Sort graph value as count distinct

Lets say I have column chart where:

- Value is "Count Distinct of a column ID" (with duplicates thus distinct count)

- Axis is column B with categories

How can I sort this graph based on the Value (Distinct Count of IDs)?

 

I do not want to modify the table to remove duplicates as it contains other columns with information and also has relations to a different table.

I do not want to create another table with deduplicated IDs for this graph as I would not be able to have all the relations that I'm using on a different column.

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

HI @Exanimis,

 

Add a calculated column to calculate distinct count based on current group, then use sort by column function to use this calculated column as sort column of column who used on value field.

Sort by column in Power BI Desktop

 

Regards,

Xiaoxin Sheng

View solution in original post

Anonymous
Not applicable

HI @Exanimis,

 

Please modify your type column to text type, it seems like default sort feature disabled when you use numeric value as axis.

29.gif

 

For this scenario, you not need calculate column anymore.

 

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @Exanimis,

 

Add a calculated column to calculate distinct count based on current group, then use sort by column function to use this calculated column as sort column of column who used on value field.

Sort by column in Power BI Desktop

 

Regards,

Xiaoxin Sheng

Actually there was a problem with your solution. It does not sort it at all or returns an error. Let me give you an example.

 

DATA:

data.png

 

 

Sort:

 

view.png

 

Calculated column:

calcol.png

Anonymous
Not applicable

HI @Exanimis,

 

Please modify your type column to text type, it seems like default sort feature disabled when you use numeric value as axis.

29.gif

 

For this scenario, you not need calculate column anymore.

 

Regards,

Xiaoxin Sheng

Thank you for help, really nice and easy solution. Not sure why I did not think of that 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors