Forum Discussion
POWER BI MATRIX
Hello
If there a table like
| code | p_no` | name | num | area |
| sa | 1 | a | 1 | a |
| sa | 1 | b | 2 | b |
| sa | 1 | c | 3 | a |
| sa | 1 | d | 4 | a |
| sa | 1 | e | 5 | b |
| sa | 1 | f | 6 | a |
| sa | 1 | g | 7 | b |
| sa | 1 | h | 8 | c |
| sa | 1 | i | 9 | c |
| sa | 2 | j | 10 | b |
| sa | 2 | k | 11 | b |
| sa | 2 | l | 12 | c |
| sa | 2 | m | 13 | a |
| sa | 2 | n | 14 | c |
with this data we can create a matrix like
| area | |||||
| p_no | a | b | c | d | |
| 1 | 4 | 3 | 2 | count of num | |
| 2 | 1 | 2 | 3 |
Here I want to add conditional color formatting to highlight the max value and add color based on area
i.e
For
a = Blue
b = Black
c = yellow
and so on.....
i.e.
Here the Similar used DAX
Thanks & Regards...
- Anonymous2 years ago
Hi BIswajit_Das ,
Sorry for being late, please change the DAX into this:Measure = var _tab=SUMMARIZE(ALLSELECTED('Sheet18'[RES]),'Sheet18'[RES], "@sumvalue",CALCULATE(COUNT(Sheet18[NUM]))) var _max= maxx( _tab,[@sumvalue]) var _area=SELECTEDVALUE('Sheet18'[RES]) return SWITCH(TRUE(),COUNT('Sheet18'[NUM])=_max&&_area="a","Blue", COUNT('Sheet18'[NUM])=_max&&_area= "b","Black",COUNT(Sheet18[NUM])=_max&&_area="c","Yellow")The final output is below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- amitchandakSuper User
BIswajit_Das , If you want on Area- a, b, c then you need to use a measure given below in conditional formatting using the field value option
Switch(Max(Table[Area]) ,
"a", "Blue",
"b", "black",
"c", "Yellow",
// add other
"green"
)
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/1682539
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pane-66e0afcb15f3- BIswajit_DasImpactful Individual
Hello amitchandak thanks for responding.
But If possible can you give an example regarding this query
i. e How to add color formating on a matrix based on the above senario.
Thanks & Regards...- AnonymousNot applicable
Hi BIswajit_Das ,
Please refer to the steps:
I create a measure by using this DAX:Measure 2 = var _tab=SUMMARIZE(ALLSELECTED('Table (2)'[area]),'Table (2)'[area], "@sumvalue",CALCULATE(SUM('Table (2)'[value]))) var _max= maxx( _tab,[@sumvalue]) var _area=SELECTEDVALUE('Table (2)'[area]) return SWITCH(TRUE(),sum('Table (2)'[Value])=_max&&_area="a","Blue", sum('Table (2)'[Value])=_max&&_area= "b","Black",sum('Table (2)'[Value])=_max&&_area="c","Yellow")
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.