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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ashicool_10061
Helper II
Helper II

Conditional Formatting with % and criteria

Hi There,

 

I am having asn issue while creating conditional formatting.

I have one column which is Service Level (%) and having values in % along with that i have criteria based on LOB'S present in my data.

I am struggling to apply conditional formatting . Can anyone help me in acheving below requirement :

So I need Conditional formatting in Serivce Level columns based on Conditions given .

 

PbI_tEST.PNG

Request to please help me in achieving this .

 

Regards,

Ash

@amitchandak @Ashish_Mathur 

2 ACCEPTED SOLUTIONS
SamWiseOwl
Community Champion
Community Champion

Hi @ashicool_10061 

Create a measure in your table and use that for formatting:

Colour measure =

var ser = sum('Table'[Service level]) --if this is a measure just put the measure name

var lob = selectedValue('Table'[LOBs])

RETURN
Switch(
True()
, ser > 0.7 || ser > 0.55 && lob IN {"A","B"} || lob = "D" && ser > 60

,"Green"

, ser > 0.6 || ser > 0.50 && lob IN {"A","B"} || lob = "D" && ser > 50

,"Yellow"

, ser > 0.5 || ser > 0.45 && lob IN {"A","B"} || lob = "D" && ser > 40

,"Red"

,"Blue")

Then assign this to your field formatting:

SamWiseOwl_0-1726655807322.png

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

(lob = "D" || si in {"d(I)",d(ii)})  && ser > 60

 

Need the brackets so they happen at the same time.

Assuming its Lob = D OR Si = "d(i)" if it is AND use &&


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

8 REPLIES 8
SamWiseOwl
Community Champion
Community Champion

Hi @ashicool_10061 

Create a measure in your table and use that for formatting:

Colour measure =

var ser = sum('Table'[Service level]) --if this is a measure just put the measure name

var lob = selectedValue('Table'[LOBs])

RETURN
Switch(
True()
, ser > 0.7 || ser > 0.55 && lob IN {"A","B"} || lob = "D" && ser > 60

,"Green"

, ser > 0.6 || ser > 0.50 && lob IN {"A","B"} || lob = "D" && ser > 50

,"Yellow"

, ser > 0.5 || ser > 0.45 && lob IN {"A","B"} || lob = "D" && ser > 40

,"Red"

,"Blue")

Then assign this to your field formatting:

SamWiseOwl_0-1726655807322.png

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Hi @SamWiseOwl 

I also need to add two more conditions which is in different columns .
Can you tell what should i modify in this?

ashicool_10061_0-1726744145358.png

Thanks,

Ashish




 

Colour measure =

 

var ser = sum('Table'[Service level]) --if this is a measure just put the measure name

 

var lob = selectedValue('Table'[LOBs])
 
var si = selectedValue('Table'[Si's])

 

RETURN
Switch(
True()
, ser > 0.7 || ser > 0.55 && (lob IN {"A","B"} || si IN {"a(i)","b(i)"})  || lob = "D" && ser > 60

 

,"Green"

 

, ser > 0.6 || ser > 0.50 && (lob IN {"A","B"} || si IN {"a(i)","b(i)"})  || lob = "D" && ser > 50

 

,"Yellow"

 

, ser > 0.5 || ser > 0.45 && (lob IN {"A","B"} || si IN {"a(i)","b(i)"})  || lob = "D" && ser > 40

 

,"Red"

 

,"Blue")

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Thank you @SamWiseOwl 
Just forget to add D aslo has SI level d(i) and d(II) . So can i add  like this ;

ser > 0.7 || ser > 0.55 && (lob IN {"A","B"} || si IN {"a(i)","a(i)"})  || lob = "D" && si in {"d(I)",d(ii)}  && ser > 60

 

,"Green"

and SO on ??

(lob = "D" || si in {"d(I)",d(ii)})  && ser > 60

 

Need the brackets so they happen at the same time.

Assuming its Lob = D OR Si = "d(i)" if it is AND use &&


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Hi @SamWiseOwl ,

 

That was really quick. Thank you for this . I appreicate it .

 

Thanks,

Ashish

Shivu-2000
Resolver IV
Resolver IV

Hi @ashicool_10061 

These might be helpful.

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

https://www.youtube.com/watch?v=m0h3Ghl6mgY

 

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

dk_dk
Super User
Super User

Hi @ashicool_10061 ,

You could do this by creating a new calculated column that captures your criteria ( using SWITCH and IF statements) and returns the corresponding hex color code. Then you can use this calculated column to drive the conditional formatting of the service level column.

I hope this helps!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.