Forum Discussion

Mitchell92's avatar
Mitchell92
Helper II
4 years ago
Solved

Conditional Formatting on Matrix - Comparing Values per Previous Month

Hi all,   Hoping to get some assistance - I have seen many posts that have similar issues, however, unable to get this to work myself.   I have a matrix with Months as the rows, and Accounts as t...
  • v-easonf-msft's avatar
    v-easonf-msft
    4 years ago

    Hi, Mitchell92 

    The dates in your original table are not consecutive, you need to create Measure 'color condition' based on a calendar table.

    Please add a calendar table, replace the date fields with those in calendar table, and change ‘color condition’ as follows:

    Color condition: = 
    VAR _currentmonth = [Values total:]
    VAR _previousmonth =
            CALCULATE (
            [Values total:],
           PREVIOUSMONTH('Calendar Table'[Date])
        )
    RETURN
        IF (
            SELECTEDVALUE ( Sheet1[Date] ) = 1,
            "Black",
            IF ( _currentmonth < _previousmonth, "Green", "Red"
        )
    )

     

    Best Regards,
    Community Support Team _ Eason