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

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.

Reply
Lamati
Frequent Visitor

Conditional formatting of fields in a table based on the result of another field

Good afternoon; I have only been doing reports in Power BI for a short time and I don't know if the question I propose will have a solution.

I have a table with different fields that make up the metadata of several projects. Each field represents a characteristic of a list of projects. To know if these fields are complete or not, we have created a table in which we count the rows of these fields for each project. The total number of projects has been put in a label that shows the count of the project ids.

 

A conditional format has been applied to the fields of the table in which, using gradient colours, if the count of the field coincides with the count of projects, the colour is green, and as this number gets smaller and closer to zero, it changes to yellow and red.

Captura de pantalla 2023-01-23 151155.jpg

El problema es que si se selecciona un proyecto en concreto, aunque el total de 

Captura de pantalla 2023-01-23 151139.jpg

The problem is that if a particular project is selected, even if the total number of project rows matches the number of rows that must be in that field, the columns of the table appear in red, because the colour gradient has been made based on fixed values.

Captura de pantalla 2023-01-23 151936.jpg

 

Is there a way to format this by creating a measure that applies to all columns and sets the colour depending on whether the count in each column matches the total number of rows in the projects?

 

Thanks in advance for your help

1 REPLY 1
amitchandak
Super User
Super User

@Lamati , You can use measure  based conditional formatting and you can use that measure in conditional formatting using field value option

 

example measures

 

Color Date = if(FIRSTNONBLANK('Date'[Date],TODAY()) < date(2022,04,10) ,
Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .75 , "Amber" ,
"Red "
) ,
Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .5 , "Amber" ,
"Red "
)
)

 

Color = Switch( True() ,
Max(Table[Status]) < 200 ,
Switch(true(),
[ERB] = .25 , "Orange" ,
"Red "
) ,
Max(Table[Status]) < 500 ,
Switch(true(),
[ERB] = .25 , "Orange" ,
"Red "
) ,
Switch(true(),
[ERB] = .25 , "Orange" ,
"Red "
)
)

 

 

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...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.