Forum Discussion
Conditional formatting based on rules
- 1 year ago
The option switching to percent is bug but it uses the option selected when applied. Alternatively, you can write a measure that returns a color based on certain conditions and use it in conditional formatting as field value (select field value instead of rules).
SWITCH ( TRUE (), [my measure] < 0, "color/hex/rgb/rgba", [my measure] > 0, "color/hex/rgb/rgba", "black" ) --use certain colors like red, blue, green, gold, gray, etc which Power BI can interpret --use hex, RGB or RGBA colors
Hi New_worker
Is _Delta supposed to be percent or number? You've inconsitently used percent and number in your conditional formatting setup.
Nothing will fit between 0.5 and 0 and what is >=0% but less than 0?
- New_worker1 year agoHelper II
Hi danextian,
_Delta is number as you see in the bar chart. The reason why I use "if values >=0 percent and < 0 number" is to match negative values.
I am confused why West (-33K) cannot be matched with the orange condition when it is placed as the third condition but can be matched when it is placed as the last one.
Also, I dont think 50 percent means 0.5..it should be median of the dataset.
- danextian1 year agoSuper User
Even though the dialogue box says percent, Power BI actually interprets the input as a decimal. So if you enter values like >= 0 and < 0, nothing will match because those conditions don’t include any valid numbers. To capture negative values, switch the option format to Number instead. Then, delete the lower input value so it defaults to Min which effectively means greater than or equal to the minimum. You can apply the same idea for the upper limit by deleting the value so it defaults to Max.
- New_worker1 year agoHelper II
Hi danextian,
Thanks for your reply. I tried, but it will go back to 100% percent as the upper limit, and 0 percent for the lower limit when I re-open the conditional formatting (fx icon). I think, 100% percent and 0 percent are the same as what you mentitioned max (number) and min (number).
My question is that why West (-33K) cannot be matched with the orange condition when it is placed as the third condition but can be matched when it is placed as the last one.