Forum Discussion
How do I create a Colour Measure for each column?
- 4 years ago
Hi HamidBee ,
According to your latest file, here's my solution.
1.Create the color measure.
Colour = SWITCH ( MAX ( '2021'[Letter] ), "A", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" ), "B", IF ( MAX ( '2021'[Value] ) > 10, "Blue", "Green" ), "C", IF ( MAX ( '2021'[Value] ) > 10, "Red", "Green" ), "D", IF ( MAX ( '2021'[Value] ) > 10, "Orange", "Green" ), "E", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" ) )2.For visual A, put Dates in Axis, Value in Values and put Letter in the vasual filter, then selete Letter is A. For visual B, select Letter is B, and so on.
3.For each visual, use the color measure for data color, get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi HamidBee ,
According to your latest file, here's my solution.
1.Create the color measure.
Colour =
SWITCH (
MAX ( '2021'[Letter] ),
"A", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" ),
"B", IF ( MAX ( '2021'[Value] ) > 10, "Blue", "Green" ),
"C", IF ( MAX ( '2021'[Value] ) > 10, "Red", "Green" ),
"D", IF ( MAX ( '2021'[Value] ) > 10, "Orange", "Green" ),
"E", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" )
)
2.For visual A, put Dates in Axis, Value in Values and put Letter in the vasual filter, then selete Letter is A. For visual B, select Letter is B, and so on.
3.For each visual, use the color measure for data color, get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
How would I ammend the code if I had measures instead? so for example I have 5 measures which calculate the total of A,B,C,D and E. e.g:
Total A = calculate(sum('2021'[Value]), Filter('2021', '2021'[Letter] ="A"))
How would one ammend your code to include all possibilities for each of the 5 measures.
Colour =
SWITCH (
MAX ( '2021'[Letter] ),
"A", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" ),
"B", IF ( MAX ( '2021'[Value] ) > 10, "Blue", "Green" ),
"C", IF ( MAX ( '2021'[Value] ) > 10, "Red", "Green" ),
"D", IF ( MAX ( '2021'[Value] ) > 10, "Orange", "Green" ),
"E", IF ( MAX ( '2021'[Value] ) > 10, "Purple", "Green" )
)
- v-yanjiang-msft4 years agoCommunity Support
Hi HamidBee ,
By my test, if you would like to write seperate measures for letter, you have to write seperate color measures as show in your above thread link. Otherwise, you can use my solution and achieve the same result.
Best Regards,
Community Support Team _ kalyj