Forum Discussion

GMS0101's avatar
GMS0101
Frequent Visitor
6 years ago
Solved

Calculate a Percentage Change using Cumulative Data

Hello gurus!   I have a situation where I am trying to track day to day percentage change for cumulative time series data in a matrix. My calculation works for the latest date of data but is blank ...
  • v-eachen-msft's avatar
    6 years ago

    Hi GMS0101 ,

     

    At first, you should use date in "Calendar" to replace date in "Combined".

    Then I editted these two measures:

    Total Confirmed = SUM ( 'Combined'[Confirmed] )
    Growth in Total Cases =
    VAR a =
        CALCULATE (
            [Total Confirmed],
            FILTER (
                ALLSELECTED ( 'Calendar' ),
                'Calendar'[Date] = MAX ( 'Combined'[Date] )
            )
        )
    VAR b =
        CALCULATE (
            [Total Confirmed],
            FILTER (
                ALLSELECTED ( 'Calendar' ),
                'Calendar'[Date]
                    = MAX ( 'Combined'[Date] ) - 1
            )
        )
    RETURN
        DIVIDE ( a - b, b )

    Here is the result.