Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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 October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
32 | |
15 | |
14 | |
13 | |
9 |