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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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