Skip to main content

Power BI

Needs Votes

Conditional formatted measures using SWITCH

Vote (3436) Share
Matt Allington's profile image

Matt Allington on 16 Jul 2016 04:20:35

A current limitation in Power BI SWITCH measures (and all Power Pivot actually) is that a SWITCH measure must have a single format. It is currently not possible to conditionally format the measure result based on any criteria - it is one single format only. There are valid use cases where you may want to change the format of the SWITCH measure depending on the result. Consider the following SWITCH statement
myMeasure = SUMX(MeasureTable,switch([selected measure],
1,[Total Sales],
2,[Total Cost],
3,[Total Margin],
4,[Chg Sales vs LY %]
))
The first 3 results are all currency format, but the last result is a percentage format. This currently can't be controlled. I would like to see an optional 3rd parameter in the SWITCH statement to set an alternate number format.

Administrator on 20 Aug 2020 01:22:10

From the comments and scenarios everyone's describing, the problem is really that you need a way to allow end-users to change which measure is displayed in a visual on the fly. As a few folks have mentioned, the FORMAT function might help in the interim, as long as you're showing the results in text rather than a chart. https://docs.microsoft.com/en-us/dax/format-function-dax has details on how to use that. The expression-based formatting feature that we've started work on may help to a certain extent, but that's really designed to change a visual's properties rather than the data type or format. We'll look into extending that work to support this scenario as well. We're moving this to Backlog status - our core plan is to build ways that end-users can change the dimensions or measures that are visible in a chart on the fly. They'll be able to explore much more freely rather than relying on the author to have set up complex expressions to control what's available. We'll update with more details as they're available.

Comments (70)
Matt Allington's profile image Profile Picture

8188c98d 8f1d-4aa5-b466-bff65aecd6f2 on 16 Aug 2020 04:17:33

RE: Conditional formatted measures using SWITCH

Same here

Matt Allington's profile image Profile Picture

a3309361 99be-ea11-a812-000d3a8ddfb2 on 16 Aug 2020 04:17:32

RE: Conditional formatted measures using SWITCH

Year after years.. Damm why Power BI Team Why.. ?

Matt Allington's profile image Profile Picture

403949ce 94ba-4ace-b4ec-414f9f5fd96b on 16 Aug 2020 04:17:17

RE: Conditional formatted measures using SWITCH

It is a nice thought that end-users can change the dimensions or measures that are visible in a chart on the fly.
But on fly is limited if it's not also applied to row formatting as described in this idea.
This is a huge limitation that will point end-users in a direction towards other tools that will have this abillity.

Matt Allington's profile image Profile Picture

a3309361 99be-ea11-a812-000d3a8ddfb2 on 16 Aug 2020 04:16:38

RE: Conditional formatted measures using SWITCH

'+1

Matt Allington's profile image Profile Picture

fec90dd7 7418-40b1-b3bc-91f6d8da48be on 16 Aug 2020 04:15:42

RE: Conditional formatted measures using SWITCH

This would be helpful to support multiple currencies support as well, since measures using the formatted data are not able to calculate. Are there any alternatives or work around for currency switch?

Matt Allington's profile image Profile Picture

6ce93847 4ba1-4959-be80-29b06b66d32e on 16 Aug 2020 04:14:46

RE: Conditional formatted measures using SWITCH

Would really help to have this

Matt Allington's profile image Profile Picture

57ae4af0 1935-475d-a218-e46c506c726f on 16 Aug 2020 04:14:43

RE: Conditional formatted measures using SWITCH

Will be a game changer

Matt Allington's profile image Profile Picture

403949ce 94ba-4ace-b4ec-414f9f5fd96b on 16 Aug 2020 04:11:14

RE: Conditional formatted measures using SWITCH

Preferably also working from Tabular cube measures and formatting.
This is currently a huge disadvantage.

Matt Allington's profile image Profile Picture

ba85214f d448-4009-ac00-dc9ac618f373 on 16 Aug 2020 04:10:33

RE: Conditional formatted measures using SWITCH

Yes please I face the same problem!!!!

Matt Allington's profile image Profile Picture

b59dc44e 2beb-4634-9268-0063d985295e on 16 Aug 2020 04:10:16

RE: Conditional formatted measures using SWITCH

Any news on this? It's a real pain point.

The alternative to this would be a measure picker in the power BI front end - then we could have a measure we could choose from (the latter is my preferred solution)