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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SalimTX
New Member

if else with conditional formatting

hi,

quick question. need to know if a single formula can satisy the following

If car_salvage_value = KBB_value and KBB_value <> 0 then true else false with the font values showing in different colors based on the condition

The former part is simple however the latter one is somewhat giving trouble

 

Thanks,

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @SalimTX ,

According to your description, I create a sample.

vkalyjmsft_0-1668395686643.png

Here's my solution, create a measure.

Color =
IF (
    MAX ( 'Table'[KBB_value] ) <> 0
        && MAX ( 'Table'[KBB_value] ) = MAX ( 'Table'[car_salvage_value] ),
    "Red",
    "Green"
)

As car_salvage_value and KBB_value are columns in my sample, I use MAX to reference the current value. IF they're measures in your model, you can remove the MAX in the code.

Then in the visualizations pane, select drop-down option of the column you want to change font color>Conditional formatting>Font color.

vkalyjmsft_1-1668396019542.png

Select the measure in the dialog.

vkalyjmsft_2-1668396198911.png

Get the result:

vkalyjmsft_3-1668396251190.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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
v-yanjiang-msft
Community Support
Community Support

Hi @SalimTX ,

According to your description, I create a sample.

vkalyjmsft_0-1668395686643.png

Here's my solution, create a measure.

Color =
IF (
    MAX ( 'Table'[KBB_value] ) <> 0
        && MAX ( 'Table'[KBB_value] ) = MAX ( 'Table'[car_salvage_value] ),
    "Red",
    "Green"
)

As car_salvage_value and KBB_value are columns in my sample, I use MAX to reference the current value. IF they're measures in your model, you can remove the MAX in the code.

Then in the visualizations pane, select drop-down option of the column you want to change font color>Conditional formatting>Font color.

vkalyjmsft_1-1668396019542.png

Select the measure in the dialog.

vkalyjmsft_2-1668396198911.png

Get the result:

vkalyjmsft_3-1668396251190.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Hi,

Thank you for your response!

We were able to make it work with two steps process however your suggestion would work.

 

Marking your reponse as an accepted solution

mariussve1
Super User
Super User

Hi,

 

Do you want to create a measure to be used in conditional formatting?

 

If so, what is car_salvage_value and what is KBB_value? Is this column name in a table or measures? Is it number or text value?

 

Could you provide an example dataset?

 

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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