cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fbeydoun Frequent Visitor
Frequent Visitor

Sorting by Measure that Uses Dynamic Format

I have a measure that dynamically changes based on a parameter that the user controls. The user can choose quantity or value from the parameter, and this measure switches to provide the selected value and formats it correctly. This is how the measure looks:

 

[Actual ] =
IF (
ISFILTERED ( 'Choose Comparison Metric'[Metric] ),
SWITCH (
TRUE (),
LASTNONBLANK ( 'Choose Comparison Metric'[Metric], "" ) = "Quantity", format(sum('Details'[Quantity]), "#,##0"),
LASTNONBLANK ( 'Choose Comparison Metric'[Metric], "" ) = "Value", format([This Month Value]/1000000, "$#,##0.0M"),
format(sum('Details'[Quantity]), "#,##0")
),
format(sum('Details'[Quantity]), "#,##0")
)

 

This part works fine, but the issue I am running into is that once this gets displayed in a matrix, Power BI is treating both of these as text and the user won't be able to sort by that column correctly if they click on the column header. I was wondering if there is a way to keep the formatting for display but force the sorting to be based on the actual value in the measure? if not, are there other solutions for this?

2 REPLIES 2
Super User
Super User

Re: Sorting by Measure that Uses Dynamic Format

No, you can’t do it. This is why the solution is only half a solution. You can vote for my idea here https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15231165-conditional-formatted-me...



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Highlighted
fbeydoun Frequent Visitor
Frequent Visitor

Re: Sorting by Measure that Uses Dynamic Format

Thanks for the info Matt! I voted on your idea.

Helpful resources

Announcements
Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 132 members 1,865 guests
Please welcome our newest community members: