cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
fbeydoun
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

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.

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors