Forum Discussion

cn4422's avatar
cn4422
Helper V
1 year ago
Solved

Calculation Group - conditional formatting

Hi,   I have a matrix table with one value and a calculation group for different time periods + calculations.   What I want is to put conditional formatting on the marked columns in red with + an...
  • DataInsights's avatar
    1 year ago

    cn4422,

     

    Try rewriting your measure like this:

     

    measure_color =
    VAR ChangeValue = [Count Forms Category]
    VAR Result =
        IF (
            SELECTEDVALUE ( 'Calc Group'[name] ) IN { "MyCalcItem1", "MyCalcItem2" },
            SWITCH ( TRUE, ChangeValue > 0, "#008000", ChangeValue < 0, "#FF0000" )
        )
    RETURN
        Result

     

    The concept is to wrap the logic in an IF statement that determines if a matrix column is one of the calculation items that needs formatting. The limitation of this approach is that you have to specify the measure name. SELECTEDMEASURE is a calculation item placeholder so it won't work in a measure. Here's a helpful video:

     

    https://www.youtube.com/watch?v=MbxJ1oHHyTg