Forum Discussion

JustinDoh1's avatar
JustinDoh1
Post Prodigy
4 years ago
Solved

Conditional formatting in Matrix's value

Hi community,   I am sharing my Pbix file here.   I am trying to apply different Background colors on Matrix. Here is my demo:   Currently, this Matrix has two parts. Left side is Actua...
  • jdbuchanan71's avatar
    4 years ago

    JustinDoh1 

    You can write a measure to check on the BudgetType[ActualOrEstimated] and return a color string like this.

     

    Value Format = 
    VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
    RETURN
    SWITCH ( 
        TRUE (),
        _Type = "Actual", "Green",
        _Type = "Estimate", "Red"
    )

     

    Then apply conditional formatting to the Values background based on the Field value of the measure:

     

    You can use color hex values instead also.

    Value Format = 
    VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
    RETURN
    SWITCH ( 
        TRUE (),
        _Type = "Actual", "#34A853",
        _Type = "Estimate", "#EA4335"
    )