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
Danch89
Frequent Visitor

Sorting Text "Currency" measure by numeric value

Hi,

 

I have a measure "Sales" - which switches between showing US sales UK or GBP or USD. I'm formatting the measure to include the correct currency as per below screenshot.

 

When I add this measure to a table and sort it, it doesn't sort per the numeric value and instead sorts as text - (because the measure is being recognised as text from the formatting). Example below.

 

Any thoughts how I can get around this so when sorting in a table it's sorted numerically whilst keeping the currency marker?

 

Danch89_0-1651767992512.png

 

Danch89_1-1651768084655.png

 

Thanks

Dan

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@Danch89 once you use the FORMAT function than you get a text and that's it 🙂
The solution for your use case is to use calculation groups (you need external tool like tabular editor for that).
You will be able to write a dynamic format string, but the value of the measure will remain a currency and you could sort it as you intended.
This is the best source to learn calculation groups (and DAX in general):

https://www.sqlbi.com/calculation-groups/

In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

View solution in original post

1 REPLY 1
SpartaBI
Community Champion
Community Champion

@Danch89 once you use the FORMAT function than you get a text and that's it 🙂
The solution for your use case is to use calculation groups (you need external tool like tabular editor for that).
You will be able to write a dynamic format string, but the value of the measure will remain a currency and you could sort it as you intended.
This is the best source to learn calculation groups (and DAX in general):

https://www.sqlbi.com/calculation-groups/

In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

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.