Forum Discussion
Conditional Formatting by Quarter
- 6 years ago
Anonymous ,
So the percentage value in your matrix is a measure you have created and you need to color the highest and lowest measure value per quarter, right?
If so, you need to convert the measure to calculate column and then create a measure to set the color rule:
Color = VAR Max_Percentage = CALCULATE ( MAX ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) ) VAR Min_Percentage = CALCULATE ( MIN ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) ) RETURN SWITCH ( Table[Percentage], Max_Percentage, "Red", Min_Percentage, "Blue" )Then click condition formatting pane of the matrix visual and select Field Value based the Color measure:
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you are creating a Matrix, here's an option...
Create a Custom Column in your table containing your Matrix values. (If you are performing sums or more complex calculations for each value, you may need to post sample data to help us determine the correct code...)
This will place (By SINGLE DATE Value - not a Range of Dates) a 1 or 0 in a Marker Column. Note Matching Values (if you have 2 Max or Mins) will have duplicate colors)
Create your Matrix and Conditionally Format the Back ground Color based on the 'Marker' Column...
Background Color = Value / Based on 'Sum of Marker'
If value is 1 then Green / if Value is 0 then Red
This is my raw data, again if you have more complex data or calculations, we'll need to see the raw input to help further.
| Date | Level | Value | Marker |
| 12/1/2018 0:00 | A | 68 | 1 |
| 12/1/2018 0:00 | B | 57 | |
| 12/1/2018 0:00 | C | 38 | 0 |
| 12/1/2018 0:00 | D | 65 | |
| 12/1/2018 0:00 | E | 42 | |
| 1/1/2019 0:00 | A | 15 | |
| 1/1/2019 0:00 | B | 13 | |
| 1/1/2019 0:00 | C | 10 | |
| 1/1/2019 0:00 | D | 16 | 1 |
| 1/1/2019 0:00 | E | 9 | 0 |
| 2/1/2019 0:00 | A | 13 | |
| 2/1/2019 0:00 | B | 17 | 1 |
| 2/1/2019 0:00 | C | 9 | 0 |
| 2/1/2019 0:00 | D | 12 | |
| 2/1/2019 0:00 | E | 13 | |
| 3/1/2019 0:00 | A | 20 | 1 |
| 3/1/2019 0:00 | B | 15 | |
| 3/1/2019 0:00 | C | 8 | 0 |
| 3/1/2019 0:00 | D | 19 | |
| 3/1/2019 0:00 | E | 10 | |
| 4/1/2019 0:00 | A | 18 | 1 |
| 4/1/2019 0:00 | B | 12 | |
| 4/1/2019 0:00 | C | 11 | |
| 4/1/2019 0:00 | D | 18 | 1 |
| 4/1/2019 0:00 | E | 10 | 0 |