Forum Discussion

StuartSmith's avatar
StuartSmith
Power Participant
6 years ago

Conditional Formatting based on cards text value.

I previously posted this question (https://community.powerbi.com/t5/Desktop/Card-Visual-Text-Colour-based-on-card-content/td-p/804248) and was given the below answer that would make the "Font" red on a card if the card value said "CLOSED".  

 

FontColor = IF(CONTAINSSTRING([AddressMeasure],"Closed"),"#FF0000","#000000")

I am currently working on a report that has roughly 25 cards and therefore I would have to create 1 measure for each card, so 25 measures.  Is there a way that I could have 1 generic measure that could be placed in "ANY" card conditional formatting section.

 

Something like... FontColor = IF(CONTAINSSTRING([Any_Measure],"Yes"),"#FF0000","#000000")

 

 

2 Replies

  • swise001's avatar
    swise001
    Continued Contributor

      StuartSmith 

    You will create one measure that handles the color logic - and then you refer to that measure in the conditional formatting section of the visual.  Something similar to this  -- just change out the <= for  [yourmeasure] = "yourtext"

     

     

     

     

    Color Selector =
    SWITCH (
        TRUE (),
        [Win %] <= 0.40, "#FF0000",
        [Win %] <= 0.65, "#FFCC00",
        [Win %] <= 1, "#00FF00"
    )

     

     

     

     

    Set conditional formatting on any part of the visual (table column, card data label, card category label, etc) that has reference to Win%

    Select "Field Value" and the color measure you created. 

     

    Instant color!

    And you can reuse this method across your whole report