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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MCacc
Helper IV
Helper IV

Dax to order column based on another column

Is it possible to explicitly create a calculated column using a dax expression to order a column based on values of another column? 

 

I have a a slicer wich has to follow the sorting I have set in PowerQuery but somehow it doesn't work in my front end since it shows the values in the filter ordered alphabetically:

 

I'd like the slicer to follow this order:

IndexField
1Germany
2Austria
3Italy
4New Zeland
5France

I also cannot use Sort Column in the data field because it returns an error of too many values for that specific row. 

 

I tried many times to clear the chace, remove the enable load of the table, and so on.. But the front end refues to reflect what is shown in my PowerQuery

 

So I'm looking for some sort of ORDER BY but that can be used in a calculated column.

 

Any ideas? thank you for your help

1 ACCEPTED SOLUTION

@MCacc I created a DAX Index once. The Mythical DAX Index - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@MCacc You should be able to create a sort by column in Power Query and use that as your Sort By column, something like:

if [Country] = "Germany" then 1 else if [Country] = "Austria" then 2 else if [Country] = "Italy" then 3 else if [Country] = "New Zealand" then 4 else 5

Not sure why you are having issues with your current Sort By unless you have multiple different countries that match the same sort by value.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you for your messege, but do you have any dax to make it dynamic since I won't have fixed values for my filter? 

 

Thanks!

 

@MCacc I created a DAX Index once. The Mythical DAX Index - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.