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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Akbera1
Helper I
Helper I

Condition formatting

Hey All,

i want condition formatting on more then 1 condition.

if type A is above 10 then or below 10% is red and type B is above 5% green and below is red.

like:

Materials      Type            Values

Ball Pen         A                  10%

Ink Pen          B                  7%

Gold Pen       C                  15%

 

Regards,

Syed Muhammad Akber

 

1 ACCEPTED SOLUTION
mdaatifraza5556
Super User
Super User

Hi @Akbera1 

Can you please try this ?

Create a measure and use conditional formatting.

ValueColor =
SWITCH(
    TRUE(),
    MAX('Table'[Type]) = "A" && MAX('Table'[Values]) < 0.10, "#FF0000",  -- Red
    MAX('Table'[Type]) = "A" && MAX('Table'[Values]) >= 0.10, "#00FF00",  -- Green
    MAX('Table'[Type]) = "B" && MAX('Table'[Values]) < 0.05, "#FF0000",  -- Red
    MAX('Table'[Type]) = "B" && MAX('Table'[Values]) >= 0.05, "#00FF00", -- Green
    BLANK()
)
 
 
 

Screenshot 2025-07-14 140741.png

 

 

If this answers your questions, kindly accept it as a solution and give kudos.

View solution in original post

8 REPLIES 8
v-sshirivolu
Community Support
Community Support

Hi @Akbera1 ,
Thank you for reaching out to Microsoft fabric community.

Thanks for sharing your requirement. I’ve implemented the solution and validated it against your logic. Here's how I achieved it:

The data has been loaded and includes the following columns: Type, Materials, and Values, with the Values presented as decimal percentages.

 

Created a DAX Measure to return color codes based on conditions:
Color Format =
SWITCH(
TRUE(),
SELECTEDVALUE('Table'[Type]) = "A" && SELECTEDVALUE('Table'[Values]) <> 0.1, "#FF0000",
SELECTEDVALUE('Table'[Type]) = "B" && SELECTEDVALUE('Table'[Values]) > 0.05, "#00FF00",
SELECTEDVALUE('Table'[Type]) = "B" && SELECTEDVALUE('Table'[Values]) <= 0.05, "#FF0000",
BLANK()
)

I’ve applied Conditional Formatting to the Values column -

Open the table visual, click the dropdown on the Values field, then select Conditional Formatting and choose Background color.

Set Format by to Field value, and for Based on field, select the Color Format measure.


Please find the attached .pbix file for your reference.

Regards,
Sreeteja.

 

Hi @Akbera1 ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.

Hi @Akbera1 ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you

 

Hi @Akbera1 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

grazitti_sapna
Super User
Super User

Hi @Akbera1 

Try this:
ColorFormat =
SWITCH(
TRUE(),
'Table'[Type] = "A" && 'Table'[Values] >= 0.10, "Green",
'Table'[Type] = "A" && 'Table'[Values] < 0.10, "Red",
'Table'[Type] = "B" && 'Table'[Values] >= 0.05, "Green",
'Table'[Type] = "B" && 'Table'[Values] < 0.05, "Red",
BLANK()
)


 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

alish_b
Resolver III
Resolver III

Hey @Akbera1 ,

You could also use a measure for this. Similar concept as a calculated column but this will be generated on the fly and then apply the conditional formatting on the 'Values' column based on Field value where you pass the measure as the field value (Please refer to the screenshot).

ConditionalFormat =

VAR TypeSelection = SELECTEDVALUE('SampleTable'[Type])

VAR ValueSelection = SUM('SampleTable'[Values])

RETURN

SWITCH(TRUE(),

    TypeSelection = "A" && ValueSelection >= 0.10 , "Green",

    TypeSelection = "A" && ValueSelection < 0.10, "Red",

    TypeSelection = "B" && ValueSelection >= 0.05, "Green",

    TypeSelection = "A" && ValueSelection < 0.05, "Red"

)

alish_b_0-1752482192167.png

Hope it helps!

mdaatifraza5556
Super User
Super User

Hi @Akbera1 

Can you please try this ?

Create a measure and use conditional formatting.

ValueColor =
SWITCH(
    TRUE(),
    MAX('Table'[Type]) = "A" && MAX('Table'[Values]) < 0.10, "#FF0000",  -- Red
    MAX('Table'[Type]) = "A" && MAX('Table'[Values]) >= 0.10, "#00FF00",  -- Green
    MAX('Table'[Type]) = "B" && MAX('Table'[Values]) < 0.05, "#FF0000",  -- Red
    MAX('Table'[Type]) = "B" && MAX('Table'[Values]) >= 0.05, "#00FF00", -- Green
    BLANK()
)
 
 
 

Screenshot 2025-07-14 140741.png

 

 

If this answers your questions, kindly accept it as a solution and give kudos.
wardy912
Solution Sage
Solution Sage

Hi @Akbera1 

 

Add the following calculated column

ColorFormat = 
SWITCH(
    TRUE(),
    'Table'[Type] = "A" && ('Table'[Values] > 0.10 || 'Table'[Values] < 0.10), "Red",
    'Table'[Type] = "B" && 'Table'[Values] > 0.05, "Green",
    'Table'[Type] = "B" && 'Table'[Values] < 0.05, "Red",
    BLANK()
)

 

Ensure the column is in decimal format.

Go to your table visual.
Click the dropdown on the Values column > Conditional formatting > Font color or Background color.
Choose Format by: Field value.
Select the ColorFormat column you just created.

 

Please give a thumbs up and mark as solved if this helps, thanks!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors