Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
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.
@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/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...
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...
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.
Hello@v-junyant-msft
Thanks for responding but can you edit the measure for this data
PCNONUMRES
1 | 1 | A |
1 | 2 | A |
1 | 3 | B |
1 | 4 | A |
2 | 5 | B |
2 | 6 | C |
2 | 7 | A |
2 | 8 | B |
3 | 9 | C |
3 | 10 | A |
3 | 11 | C |
3 | 12 | C |
here the measure is like
i.e
In rows - pcno
columns - res
values - count(num)
Thanks & regards..
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
99 | |
76 | |
67 | |
61 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |