Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Conditional Formatting Scenario Help

Hi, I am trying to apply some conditional formatting on a matrix visual that contains Month- Year as columns, and metrics (Some of which are measures)  as values, with “Show on Rows” turned on.   ...
  • v-angzheng-msft's avatar
    v-angzheng-msft
    5 years ago

    Hi, Anonymous 

     

    Keep the result measure unchanged, and change the color measure as follows:

     

    _showResult = 
    IF (
        MAX ( 'Goals'[Metric] ) = "Packages Sent",
        SUM ( [Packages Sent] ),
        IF (
            MAX ( 'Goals'[Metric] ) = "Packages Received",
            SUM ( [Packages Received] ),
            FORMAT ( SUM ( [Packages Sent] ) / SUM ( [Packages Received] ), "0%" )
            // SUM ( [Packages Sent] ) / SUM ( [Packages Received] )
        )
    )
    _color =
    VAR _cpResult =
        IF (
            MAX ( 'Goals'[Metric] ) = "Packages Sent",
            SUM ( [Packages Sent] ),
            IF (
                MAX ( 'Goals'[Metric] ) = "Packages Received",
                SUM ( [Packages Received] ),
                SUM ( [Packages Sent] ) / SUM ( [Packages Received] )
            )
        ) // return IF([_cpResult]>=[goals],"Green","red")
    RETURN
        IF ( _cpResult >= [goals], "Green", "red" )
    

     

    Result:

    Hope this helps.

     

    Best Regards,
    Community Support Team _ Zeon Zheng


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.