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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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