Forum Discussion
How do I create a conditional 'Colour Measure' for the 'value' column?
- Anonymous4 years ago
Hi HamidBee ,
You are creating measure, you will need to use SELECTEDVALUE() or SUM() function to capture the value from the visual.
For example:
color = SWITCH(TRUE(),SELECTEDVALUE('2021'[value])>0,"#006400",SELECTEDVALUE('2021'[value])<0,"#800020")
Use SELECTEDVALUE() or SUM() or AVERAGE() depend on your needs.
Best Regards,
Jay
HamidBee you can create conditional like below
you can modify the hexcode of the color and conditioanl for color as per your choice
- HamidBee4 years agoPower Participant
Thank you for your reply. I wrote a reply to "amitchandak" below explaining in more detail what I was hoping to do.
I could use what he suggested:
if(sum(2021[Value]) >0 , "Green", "Red")
but if I create a bar chart to say the measure 'Total B vs Months', the bars would all remain green since the sum of the 2021 values is always greater than zero. So if there is a negative number it would still remain green.
I could use:
SWITCH(TRUE(),[Total A]>0,"Green", [Total A]<0,"Red")However, this would mean I'd need to create a seperate measure for each category which I can do but I'm trying to figure out a way to avoid this if possible.Side note: Why is conditional formatting not available when creating a bar chart with two ore more categories in the values section?