Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
Thanks in advance for your support!
I have written a dax measure (called as Master Measure) which returns formatted values using SWITCH:
On this measure I want conditional formatting on few statements in switch, not all. Formatting - red color for negative, green color for positive. Example DAX as shown below, I want color on SELECTEDVALUE(SALES_KPI_TRACKER[ORDER])=7 :
However, I am not able to achieve the desired formatting. An error in specifying positive / negative value is occurring i.e. in the part : [Master_Measure]>0. I tried removing FORMAT in first main dax, however, still not working.
Request your help on the same. Thanks
Solved! Go to Solution.
Change the Format setting of your Master Measure to be dynamic and copy the switch statement into the Format String Expression. Have the switch statement in the measure just return the value without any formatting, and you should then be able to use conditional formatting as normal.
@Dr_BB - Both FORMAT and FIXED return a string value (text) which will be why you're unable to use an interger or decimal based rule.
You should make use of Dynamic Formatting for your measure, rather than the measure returning a string value.
https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/
If this helps, please consider marking it as the solution, it helps with visibility for others with the same challenge.
Hi @Dr_BB ,
Is my follow-up just to ask if the problem has been solved?
If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?
Thank you very much for your cooperation!
@Dr_BB - Both FORMAT and FIXED return a string value (text) which will be why you're unable to use an interger or decimal based rule.
You should make use of Dynamic Formatting for your measure, rather than the measure returning a string value.
https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/
If this helps, please consider marking it as the solution, it helps with visibility for others with the same challenge.
Change the Format setting of your Master Measure to be dynamic and copy the switch statement into the Format String Expression. Have the switch statement in the measure just return the value without any formatting, and you should then be able to use conditional formatting as normal.
You cannot measure a measure. Implement your conditional formatting rules in a separate parallel measure.
User | Count |
---|---|
25 | |
11 | |
7 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |