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

Custom sort order in two charts

Hi,

 

I have a request to custom sort two charts based on the same table but different columns. I know that I can create sorting order column for one chart but I am not sure how can I do that for a different chart that needs to be sorted on a completely different column. Is it even possible?

 

Just to clarify, I do not need custom sorting based on two columns, these are two separate charts. I need these custom sort orders because of color coding chart categories but the problem is that these categories originate in two separate columns with different values.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , you can not sort same column on two different method

 

Column 1Sorted on Sort1

 

then if you need to sort on sort 2, then try

Column 2 = [column 1]

now sort column 2 on sort 2 and use column 2 in the visual https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

View solution in original post

@Anonymous  In Power Query, add new Conditional Column to the table in your screenshot: 

 

If  Priority equals Low then 1

add condition

If Priority equals Medium then 2

add condition

If Priority equals High then 3

else 4

Name this column [PrioritySort]

 

Then repeat with a new conditional column for [Time Left Sort]

And then you can use the 'Sort by Column' functionality to sort Priority by [PrioritySort] and Time Left by [TimeLeftSort] . 

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , you can not sort same column on two different method

 

Column 1Sorted on Sort1

 

then if you need to sort on sort 2, then try

Column 2 = [column 1]

now sort column 2 on sort 2 and use column 2 in the visual https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

AllisonKennedy
Super User
Super User

@Anonymous  I'm not sure I understand, what chart/visual are you trying to sort? If it's a table visual you can just click the table heading to sort by that column. If you're trying to sort the same column in a different order on two different visuals, this is not possible. You'll need to create a copy of that column, and change the sort order for it to match the new visual. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi Allison,

 

I am trying to sort stacked column charts based on this logic

 

2020-12-21_10h52_44.png

 

One stacked column chart shows priority values and the second chart shows time left. If I create custom sort order column for priority column to display colors in certain way (dark green, yellow, red in that order) then my time left chart is not going to be sorted in the same way and vice versa. I basically need both stacked charts to show categories in this order (dark green, yellow, red). 

 

Hopefully this makes it somewhat clearer.

@Anonymous  In Power Query, add new Conditional Column to the table in your screenshot: 

 

If  Priority equals Low then 1

add condition

If Priority equals Medium then 2

add condition

If Priority equals High then 3

else 4

Name this column [PrioritySort]

 

Then repeat with a new conditional column for [Time Left Sort]

And then you can use the 'Sort by Column' functionality to sort Priority by [PrioritySort] and Time Left by [TimeLeftSort] . 

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you add some screesnhots around this issue please?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.