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 need to use a measure
example
if(sum(2021[Value]) >0 , "Green", "Red")
Other example
Colour =
SWITCH(TRUE(),
max('Table'[Month Year]) = "Jan-2020", "red",
Max('Table'[Month Year]) < "Feb-2020", "orange",
//keep on adding
"green")
How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4
- HamidBee4 years agoPower Participant
Thank you. The first code you wrote is closer to what I want to do however if I use it it would always make the bar green as the total is always greater than zero. What I was o=planning to do is to make a bar chart for each category A,B,C,D & E where the colour measure would work for each one. So Total A, Total B etc. I understand that it could be done by creating an individual colour colur measure for each one but it would be lengthy and I was wondering whether I could just make one colour measure that would take all scenarios into consideration.
- Anonymous3 years agoNot applicable
Hi,
Did you findout any solution for this? If so can you please share the measure formula. I also need to create the same color code for different categories
Thanks in Advance....