Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm formating a card by FIELD VALUE
Is there a way to get this switch formula to turn greater than 0 green e.g. "#094" and red if less than 0 e.g. "#d64550";
My current code is:
You can't have one measure that will return different values for the average in 2019 and 2020. Only the first true condition will be honored. So, you see 18.54% being red because this color comes from the other measure. In all honesty, in your color measure none of the 3 last conditions will ever be hit since the first 3 already cover all possibilities. Use 2 different color measures for the 2 different numerical measures. By the way, in the measures given by @nandukrishnavs you don't have to multiply by 100 since you're only comparing to 0.
Try to write two measures.
Color2019 =
VAR _val = [% Average 2019]*100
VAR _result =
SWITCH (
TRUE (),
_val > 0, "#D64550",
_val = 0, "#252423",
_val < 0, "#094"
)
RETURN
_result
Color2020 =
VAR _val = [% Average 2020] * 100
VAR _result =
SWITCH (
TRUE (),
_val > 0, "#D64550",
_val = 0, "#252423",
_val < 0, "#094"
)
RETURN
_result
If your format of measure ([% Average 2020], [% Average 2019) is not the percentage, then you don't need to multiply 100.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
20 | |
18 | |
16 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |