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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
graefs
Frequent Visitor

Conditional Formatting - Standard Table

Problem: I cannot conditionally format based on two seperate KPIs we have set (See below).

 

Attempted Solutions:

-Switch Statements (I have only seen examples with one condition.. example if Type 'A' then "Green")

-Rules (IF Jan >= 98% and <= 100% then Green)

  • This works for Quality/Velocity but not Utilization

The only solution I can think of is to create a seperate table for Utilization.

 

Metric Definitions:

Quality/Velocity: 

  • Good - >=98.0%
  • Okay - >=97.5% & <98.0%
  • Bad - <97.5%

Utilization: 

  • Good - >=93%
  • Okay - >=91% & <93%
  • Bad - <91%

Desired Result:

MetricTypeJanFeb
QualityA98.0%90.5%
QualityB99.0%98.3%
QualityC97.7%96.2%
VelocityA94.6%99.1%
VelocityB100.0%93.9%
VelocityC99.0%100.0%
UtilizationA94.8%88.5%
UtilizationB90.9%95.0%
UtilizationC92.1%91.9%
1 ACCEPTED SOLUTION
_AAndrade
Resident Rockstar
Resident Rockstar

Hi,

Please try this:

_AAndrade_0-1711563432069.png

 

Color Format = 
VAR _Metric = SELECTEDVALUE(T_CondFormat[Metric])
VAR _Value = SELECTEDVALUE(T_CondFormat[Jan])
VAR _Result = 

SWITCH(
    TRUE(),
    _Metric IN {"Quality", "Velocity"} && _Value >=0.98 || _Metric IN {"Utilization"} && _Value >=0.93, "GREEN",
    _Metric IN {"Quality", "Velocity"} && _Value >=0.975 || _Metric IN {"Utilization"} && _Value >=0.91, "YELLOW",
    _Metric IN {"Quality", "Velocity"} && _Value < 0.975 || _Metric IN {"Utilization"} && _Value < 0.91, "RED"
)

RETURN
    _Result

 


Probably you need to create one of this measures for each column with values, but it depends of your data model.

 

Example of the output for column Jan:

_AAndrade_1-1711563591640.png

 


 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




View solution in original post

4 REPLIES 4
_AAndrade
Resident Rockstar
Resident Rockstar

Hi,

Please try this:

_AAndrade_0-1711563432069.png

 

Color Format = 
VAR _Metric = SELECTEDVALUE(T_CondFormat[Metric])
VAR _Value = SELECTEDVALUE(T_CondFormat[Jan])
VAR _Result = 

SWITCH(
    TRUE(),
    _Metric IN {"Quality", "Velocity"} && _Value >=0.98 || _Metric IN {"Utilization"} && _Value >=0.93, "GREEN",
    _Metric IN {"Quality", "Velocity"} && _Value >=0.975 || _Metric IN {"Utilization"} && _Value >=0.91, "YELLOW",
    _Metric IN {"Quality", "Velocity"} && _Value < 0.975 || _Metric IN {"Utilization"} && _Value < 0.91, "RED"
)

RETURN
    _Result

 


Probably you need to create one of this measures for each column with values, but it depends of your data model.

 

Example of the output for column Jan:

_AAndrade_1-1711563591640.png

 


 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Thank you this works! Not ideal that I will need to create a measure for each column but I will get the result I need!

@graefs If you change you data model a little bit you will only need one measure.
If you build a table like this:

_AAndrade_0-1711575712064.png
After you could use a matrix visual like this:

_AAndrade_0-1711576733598.png

 

And the color format would be this:

Color Format V2 = 
VAR _Metric = SELECTEDVALUE('T_CondFormat V2'[Metric])
VAR _Value = SUM('T_CondFormat V2'[Value])
VAR _Result = 

SWITCH(
    TRUE(),
    _Metric IN {"Quality", "Velocity"} && _Value >=0.98 || _Metric IN {"Utilization"} && _Value >=0.93, "GREEN",
    _Metric IN {"Quality", "Velocity"} && _Value >=0.975 || _Metric IN {"Utilization"} && _Value >=0.91, "YELLOW",
    _Metric IN {"Quality", "Velocity"} && _Value < 0.975 || _Metric IN {"Utilization"} && _Value < 0.91, "RED"
)

RETURN
    _Result






 







Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




kaylastarr
Advocate V
Advocate V

Hello,
My suggestion would be to create a measure that calculates the color you would like to display and use that as your conditional formatting field, instead of rules.

 

In the measure you can have an if statement that goes like this

Color of Text = If(Metric="Utilization",If(Value>=.93,"Green",If(Value<=91,"Red",(If(So on and so forth with nested If's)


Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors