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
vjnvinod
Impactful Individual
Impactful Individual

Conditional formatting question

Dear experts,

 

this is the visual I have created in power BI

vjnvinod_0-1644237137195.png

 and P7W4 is a measure 

P7W4 = CALCULATE( DIVIDE(SUM('WTD FY22'[CH]),SUM('WTD FY22'[EAH]),"n/a"),'WTD FY22'[Period Week]="P7WK4")
I need to conditionally put some background color based on the below table rule
 if with the combination of SSL, Rank, Lower and Upper limit
P7W4 <= Lower Limit, then Red background, if P7W4="n/a", then grey color background and if P7W4> Lower Limit, Green background
But I am not sure, how to achieve this on the Power BI desktop
SSLRankTarget UtilizationLower LimitUpper Limit
ITTSSenior75%65%85%
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @vjnvinod 

Create a measure to return the color value .

Measure = Switch( True() ,
[P7W4] =BLANK(),"Grey",
[P7W4] <= SELECTEDVALUE('Table'[Lower Limit]) , "red" ,
[P7W4] > SELECTEDVALUE('Table'[Lower Limit]) , "Green" )

Then set conditional formatting for [P7W4] in table visual . Choose Field value for Format style , Measure for What field should we base this on .

Ailsamsft_0-1644480870990.png

 Ailsamsft_1-1644480870991.png

The final result is as shown :

Ailsamsft_2-1644480870992.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

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
Anonymous
Not applicable

Hi @vjnvinod 

Create a measure to return the color value .

Measure = Switch( True() ,
[P7W4] =BLANK(),"Grey",
[P7W4] <= SELECTEDVALUE('Table'[Lower Limit]) , "red" ,
[P7W4] > SELECTEDVALUE('Table'[Lower Limit]) , "Green" )

Then set conditional formatting for [P7W4] in table visual . Choose Field value for Format style , Measure for What field should we base this on .

Ailsamsft_0-1644480870990.png

 Ailsamsft_1-1644480870991.png

The final result is as shown :

Ailsamsft_2-1644480870992.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

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

mh2587
Super User
Super User

color measure =

Switch( True() ,

[P7W4] < [Lower] , "red" ,

[P7W4] > [Upper] , "Green" ,

"Grey"

)


✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn
amitchandak
Super User
Super User

@vjnvinod , That "n/a", might convert it to text

 

But you can create a measure like

Switch( True() ,

[P7W4] < [Lower] , "red" ,

[P7W4] > [Upper] , "Green" ,

"Yellow"

)

 

and you can use that in conditional formatting using field value option

 

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