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.

Conditional formatted measures using SWITCH

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.
Status: Declined
Comments
ashley_edwards
New Member
Common problem and very important. Please add this.
hectorv
New Member
It is possible to show different formats in the same column for a TableMatrix as shown below. In a Matrix use the formatting Values option "Show in Rows". http://hectorv.com/table-or-matrix-for-side-by-side-column-comparison-with-columns-with-different-formats-in-the-same-column-updated
paul80
New Member
I've encountered this as well. I klugy work around is to return a formatted string for the measure. Not an ideal solution, I admit.
colinbanfield1
New Member
Mixing program logic with presentation logic is not a good idea. Since SWICH is syntax sugar for nested IFs, it is equivalent to adding a number format parameter to an IF statement. SWITCH is not the right place for setting conditional number formats. The correct place is in conditional formatting. At the time of this comment, Excel has had the capability for ten years.
mstacey
Advocate I
This is also needed for multi currency, which is possibly a more common scenario
nasir85shaikh
New Member
We also need Custom Number format. So that we can use our own number formats just like excel.
chris_larsen
New Member
Common problem and very important. Please add this!
papapita_gustav
New Member
Power Bi has so many nice features, please add this it will be very helpful
sacupolo
New Member
Would truly add some flexible functionality. I have a matrix that has multiple measures that are inter-related (QTY, Unit Rate, Hours, Unit Price, etc. Putting them all on a matrix at the same time is confusing for the end user. Adding a slicer to select the measures that the user wants to see makes for a valuable analytic. Using Switch is the only current option. However, a better option would be to just build the functionality into the matrix and slicer essentially building a field filter.
dcresp1
New Member
This one is so simple but would make my dashboard formatting SO much better. Please MS take a look at this much-needed improvement.