Forum Discussion

SalimTX's avatar
SalimTX
New Member
3 years ago
Solved

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 colo...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi SalimTX ,

    According to your description, I create a sample.

    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.

    Select the measure in the dialog.

    Get the result:

    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.