Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Target Met conditional formatting

If target <=Actual then Actual value show show in Green font/ background color else Red

Thanks.

  • Hi Anonymous,

    Create a Measure that returns the Hex Code you want to apply to your Back/Font Color, then use the Field Value option when setting up conditional formatting

    back color = if([target]<=[actual], "#008000", "#FF0000")

    Hope this helps,

     

    Richard


    Did I answer your question? Mark my post as a solution!
    Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up! 

10 Replies

  • Anonymous , create a measure that returns color based on this condition and use that in conditional formatting with "Field" Option

     

    Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
    Color Year = if(FIRSTNONBLANK(Table[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
    
    Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
    ,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
    Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

     

    refer

    https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
    https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

  • richbenmintz's avatar
    richbenmintz
    Resident Rockstar

    Hi Anonymous,

    Create a Measure that returns the Hex Code you want to apply to your Back/Font Color, then use the Field Value option when setting up conditional formatting

    back color = if([target]<=[actual], "#008000", "#FF0000")

    Hope this helps,

     

    Richard


    Did I answer your question? Mark my post as a solution!
    Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up! 

    • Anonymous's avatar
      Anonymous
      Not applicable

      richbenmintz 

      Thank you for your solution. Now I got one measure with color code. How can I use this with conditional formating so font or background of Target color should get.

      • richbenmintz's avatar
        richbenmintz
        Resident Rockstar

        Hi Anonymous,

         

        You would use the conditional value by value option