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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
yuhkao
Microsoft Employee
Microsoft Employee

Conditional format on each row with different criteria

Hi Expert

 

I have matrix and would like to setup conditional formating with different criteria on each row. can i do that?

 

for example

                            Jan-2020  Feb-2020  Mar-2020  Apr-2020

commodity1         data         data          data          data

commodity2         data         data          data          data

commodity3         data         data          data          data

 

data greater than 500 on commodity1

data greater than 1000 on commodity2

data greater than 1500 on commodity3

 

as you can see above, each row has different criteria, not sure power bi has this feature or not. thanks 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @yuhkao , 

Did you mean below part show red, then others show the same? You could use "||" , which represent "or" (you could follow my logic, switch(true(), condition1, color code, condition2 , color code, color code(this part is used for other conditions except above conditions))

c1> 3000

c2> 5000

c3......c10> 500

Measure 3 = var c1= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c1"))   var c2= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c2"))   var c3= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c3"))   return switch(TRUE(), c1>3000||c2>5000||c3>500||c4>500||c5>500 , "#ff0019", "#42dfed")

 

Best Regards,
Zoe Zhi

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

8 REPLIES 8
dax
Community Support
Community Support

Hi @yuhkao , 

You could refer to my sample for details

Best Regards,
Zoe Zhi

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

yuhkao
Microsoft Employee
Microsoft Employee

@dax  seems work now, thanks

one more quick question for Measure3 formula, i got several commodities, only c1, c2 are different criteria, others are the same, can i have formular of it? thanks 

 

for example,

c1> 3000

c2> 5000

c3......c10> 500

 

can you help? thanks 

dax
Community Support
Community Support

Hi @yuhkao , 

Did you mean below part show red, then others show the same? You could use "||" , which represent "or" (you could follow my logic, switch(true(), condition1, color code, condition2 , color code, color code(this part is used for other conditions except above conditions))

c1> 3000

c2> 5000

c3......c10> 500

Measure 3 = var c1= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c1"))   var c2= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c2"))   var c3= CALCULATE(SUM(T2[amount]), FILTER('T2',T2[name]="c3"))   return switch(TRUE(), c1>3000||c2>5000||c3>500||c4>500||c5>500 , "#ff0019", "#42dfed")

 

Best Regards,
Zoe Zhi

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

yuhkao
Microsoft Employee
Microsoft Employee

thanks for helping and provide solution clearly. 

appreciate!!

yuhkao
Microsoft Employee
Microsoft Employee

Hi Expert

 

Based on this question, I got deeper equation on data and would like to apply conditional format with color code on different threshold.

 

example:

                            Jan-2020  Feb-2020  Mar-2020  Apr-2020

commodity1         data         data          data          data

commodity2         data         data          data          data

commodity3         data         data          data          data

 

Data threhold1 =  initial goal + 1 *2.57* SQRT(initial goal*(1- initial goal)/base)

Data threhold2 =  initial goal + 2 *2.57* SQRT(initial goal*(1- initial goal)/base)

Data threhold3 =  initial goal + 3 *2.57* SQRT(initial goal*(1- initial goal)/base)

*initial goal is different upon commodity

*base is differnt upon month usage or commodity

 

With data threhold1 to 3, would like to apply different color code, like green, yellow, red

thanks 

amitchandak
Super User
Super User

@yuhkao ,

Create a measure like this

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

 

And use that in conditional formatting after choosing the field value

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...

https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

can i have all red color with commodity1 reach 500 and commodity2 reach 1000?

@yuhkao , you can any color name or hexcode with #. You can play around with conditions

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.