Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rajendracheraku
New Member

conditional formatting for matrix rows based on different condition

Hello Experts, 

 

Need your expertise help on conditional formatting.

 

I have two dimensions and one measure in a matrix table.

 

Country, KPI - Dimension; Measure - Measure

 

Need to apply coditional formatting (red and green) based on different condition

for each row . I tried several ways but not able to acheive this. Please help

 

For row A - India, Mexico and AUS should be in Green and USA should be in Red

For row B - India, Mexico, USA should be in Green and AUS should be in Red

For row C - India, Mexico, USA should be in Green and AUS should be in Red

 

KPIIndiaMexicoUSAAUS  
A999794100 A>95 Green Else Red
B981009992 B>93 Green else Red
C7954 C>5 Green else Red
1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @rajendracheraku ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a color measure. 

color = SWITCH(TRUE(),
[Measure] >=95 && SELECTEDVALUE('Table'[KPI])="A","Green",
[Measure] >=93 && SELECTEDVALUE('Table'[KPI])="B","Green",
[Measure] >=5 && SELECTEDVALUE('Table'[KPI])="C","Green",
"Red")

(3) Setting the conditional format and then the result is as follows.

vtangjiemsft_0-1706838472591.pngvtangjiemsft_1-1706838514725.pngvtangjiemsft_2-1706838540943.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @rajendracheraku ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a color measure. 

color = SWITCH(TRUE(),
[Measure] >=95 && SELECTEDVALUE('Table'[KPI])="A","Green",
[Measure] >=93 && SELECTEDVALUE('Table'[KPI])="B","Green",
[Measure] >=5 && SELECTEDVALUE('Table'[KPI])="C","Green",
"Red")

(3) Setting the conditional format and then the result is as follows.

vtangjiemsft_0-1706838472591.pngvtangjiemsft_1-1706838514725.pngvtangjiemsft_2-1706838540943.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Thank you for providing PBIX file as well

 

Thank you so much Champ. You made my day easy. One more request. Right now the values are hard coded (95, 93 and 5). If I need to keep in a table so that in future they might get change. Then how should I change formula? Any help is highly appreciated.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.