Forum Discussion

gwoodley's avatar
gwoodley
Frequent Visitor
2 years ago
Solved

Martix Conditional Formating

Hi I have a matrix table that will add a column for each new year to show a percentage against countries.

What I would like to do is format the percentages to identify if they have increased, or decreased from the year before, ideally by adding Icons - Percentage increased show Green up Triangle, Percentage decreased show Red Down Triangle.

 

The years are created using Date hierarchy - Year

The values based on a column - ([Average]/100)

 

Is this possible?

Thanks

 

  • gwoodley 

     

    CF =
    VAR curr = MAX('Table'[Year])
    VAR currValue = CALCULATE(SUM('Table'[Value]), 'Table'[Year] = curr)
    VAR prevValue =
        CALCULATE(
            SUM('Table'[Value]),
            FILTER(ALL('Table'[Year]), 'Table'[Year] < curr)
        )
    RETURN
        SWITCH(
            TRUE(),
            ISBLANK(prevValue), BLANK(),
            currValue > prevValue, 1,
            currValue < prevValue, 2,
            currValue = prevValue, 3,
            4
        )
    try this
     

2 Replies

  • ddpl's avatar
    ddpl
    Solution Sage

    gwoodley 

     

    CF =
    VAR curr = MAX('Table'[Year])
    VAR currValue = CALCULATE(SUM('Table'[Value]), 'Table'[Year] = curr)
    VAR prevValue =
        CALCULATE(
            SUM('Table'[Value]),
            FILTER(ALL('Table'[Year]), 'Table'[Year] < curr)
        )
    RETURN
        SWITCH(
            TRUE(),
            ISBLANK(prevValue), BLANK(),
            currValue > prevValue, 1,
            currValue < prevValue, 2,
            currValue = prevValue, 3,
            4
        )
    try this