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.
Hi!
I made this code that will change colors on my dashboard depending whether the value in question is negative or positive, but I did also want to have a third color(orange), which would signify that the value is not to far off neagative:
Bounce Rate Color Leaflet BE = SWITCH(
TRUE(),
[Bounce Rate (Up to Current Month) Leaflet BE] > [Bounce Rate Leaflet BE], "#00FF00", --green
[Bounce Rate (Up to Current Month) Leaflet BE] < [Bounce Rate Leaflet BE], "#FF0000",
AND([Bounce Rate Dif Current year and past year Leaflet BE] >= 0.01, [Bounce Rate Dif Current year and past year Leaflet BE] <= 1), "#FFA500", --orange
"#000000"
)
but of course the orange won't work since there is no hierarchy amongst the different sections of the coding, so the green and the red always override the orange. With this in mind, what would be the best solution to introducing this third color?
Thank you very much for your time.
Solved! Go to Solution.
Thank you.
At the end the best solution I found was to convert the colors into variables
Can you try switch up the order of the switch statements - i.e
Bounce Rate Color Leaflet BE = SWITCH(
TRUE(),
AND([Bounce Rate Dif Current year and past year Leaflet BE] >= 0.01, [Bounce Rate Dif Current year and past year Leaflet BE] <= 1), "#FFA500", --orange
//-- green
//-- orange
)
so that the orange will evaluate first before it meets the green / orange conditions?
There are also ways to format based on the level of the heirarchy - you can add additional conditions ISFILTERED or ISINSCOPE to determine the current level.
Otherwise, you will need to go back and change the [Bounce Rate Leaflet BE] measures to either return BLANK / some other value depending on the heirarchy levels.
Thank you.
At the end the best solution I found was to convert the colors into variables
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
4 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |