Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have a table like the following. I want to set a conditional format background color based on the name and numerical value. Multiple rules based on the name in the first column and value in the second.
For Example:
If Audit Manager = "Fred" & Audits = 20 then green
If Audit Manager = "Fred" & Audits <20 then yellow
If Audit Manager = Fred & Audits >20 then Red
If Audit Manager = George & Audits =3 then Green
If Audits Manager = George & Audits ❤️ then yellow
If Audit Manager = George & Audits >3 then Red
| Audit Manager | Audits | 
| Fred | 20 | 
| George | 1 | 
| Ginny | 80 | 
| Ron | 2 | 
| Percy | 20 | 
I think I need a measure to refer to when applying the conditional formating on the table but not entirely sure of code that is needed.
It looks like it should be easy, but please note a value of 3 for one name might be red but for another name it might be green. I need separate rules based on the names and numbers.
Hi @DMB1 - this will work. Note that the yellow isn't showing up great on my image, but George is indeed yellow as i it is 1. Fred is also green, which is kind of dark.
Tracked Manager = 
VAR varManagerName = MAX('Table'[Audit Manager])
VAR varAudits = MAX('Table'[Audits])
VAR Result = 
    SWITCH(
        TRUE(),
        AND(varManagerName = "Fred", varAudits = 20), "green",
        AND(varManagerName = "Fred", varAudits < 20), "yellow",
        AND(varManagerName = "Fred", varAudits > 20), "red",
        AND(varManagerName = "George", varAudits = 3), "green",
        AND(varManagerName = "George", varAudits < 3), "yellow",
        AND(varManagerName = "George", varAudits > 3), "red"
    )
RETURN
    Result
Note you can replace red/green/yellow with hex colors, so the following works. You must remember the # sign for hex numbers:
Tracked Manager = 
VAR varManagerName = MAX('Table'[Audit Manager])
VAR varAudits = MAX('Table'[Audits])
VAR Result = 
    SWITCH(
        TRUE(),
        AND(varManagerName = "Fred", varAudits = 20), "green",
        AND(varManagerName = "Fred", varAudits < 20), "#FFD300",
        AND(varManagerName = "Fred", varAudits > 20), "red",
        AND(varManagerName = "George", varAudits = 3), "green",
        AND(varManagerName = "George", varAudits < 3), "#FFD300",
        AND(varManagerName = "George", varAudits > 3), "red"
    )
RETURN
    ResultThat gives you a darker yellow for example.
The conditional format for the font color is this, where "Tracked Manager" is the measure name I chose.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | 
| User | Count | 
|---|---|
| 23 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |