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.
I need to change the card data value color dynamically by a measure that I can use in the fx of that card!
I have tried as below but it always shows green color; (colors need to be changed in range as below) GREEN-RED-BLACK
Also would like to add this if condition with above as well:
Solved! Go to Solution.
Hi @ngoswami ,
In your measure, Any value will satisfy the first two conditions, greater than 0 or less than 0.01, so it always returns green. If your desired result is :
0<Value<0.01 then green;
-0.01<Value<0 then red;
Value=0 then black.
Then here's my solution.
Measure =
IF (
'Variance Selection'[Lead Variance %] > 0
&& 'Variance Selection'[Lead Variance %] < 0.01,
"#2DD224",
IF (
'Variance Selection'[Lead Variance %] > -0.01
&& 'Variance Selection'[Lead Variance %] < 0,
"#D64550",
IF ( 'Variance Selection'[Lead Variance %] = 0, "#000000" )
)
)
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.
Hi @ngoswami ,
In your measure, Any value will satisfy the first two conditions, greater than 0 or less than 0.01, so it always returns green. If your desired result is :
0<Value<0.01 then green;
-0.01<Value<0 then red;
Value=0 then black.
Then here's my solution.
Measure =
IF (
'Variance Selection'[Lead Variance %] > 0
&& 'Variance Selection'[Lead Variance %] < 0.01,
"#2DD224",
IF (
'Variance Selection'[Lead Variance %] > -0.01
&& 'Variance Selection'[Lead Variance %] < 0,
"#D64550",
IF ( 'Variance Selection'[Lead Variance %] = 0, "#000000" )
)
)
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.
The condition is wrong. Instead of IF, please use SWITCH (https://dax.guide/switch) and remember that the conditions are evaluated in the sequence you define.
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |