Forum Discussion

aulona12's avatar
aulona12
Frequent Visitor
4 years ago
Solved

How to apply the same conditional formatting on multiple columns?

Hello all,    Is there a way to apply the same conditional formatting, in this case red colored font for all values that are less then zero, for multiple columns at a time? The method that i am usi...
  • speedramps's avatar
    4 years ago
     

    Please consider this solution and remember I am an unpaid Power BI volunteer, so click the thumbs up button if you like me helping you and the solved button if I fix your problem.

    Click here for an example solution 

     

    This example has the targets in table but you could hard code them in a switch statement.
    A table is better because the users can edit the targets without a PBI developer changing DAX. 


    Create a dax measure like this

    KPI Colour =
    VAR mytarget = SELECTEDVALUE(Facts[Target])
    RETURN
    IF(SUM(Facts[Value])> mytarget"Red","Green")
     
    Then in conditioinal formating select
    Format Style = Field Value

    What field should we base this on = KPI Colour