Forum Discussion

giorgi_lommidd's avatar
6 years ago
Solved

Cumulative sum for specific time period

Hi All, 
I have 'Table1' with column 'Amount', 'date' which ranges from 2015/1/1 to 2019/12/31. I another table 'DateHelper' with a column 'date' which ranges from 2019/1/1 to 2019/12/31. I also have one to many relation between 'DateHelper' and 'Table1' by 'date' column. I need to calculate cumulative sum of 'Amount' with following visualization: let's take line chart, where y-axis directs to cumulative of 'Amount' and x-axis directs to 'date' column from 'DateHelper' (to repeat: Ranges from 2019/1/1 to 2019/12/31 ). I need to show cumulative sum of 'Amount' where year < 2019 for first day of the chart and from this point continue calculation of cumulative sum.

  • giorgi_lommidd 

     

    You may add the following measure.

    Measure =
    CALCULATE (
        SUM ( Table1[Amount] ),
        FILTER ( ALLSELECTED ( Table1 ), Table1[Date] <= MAX ( DateHelper[Date] ) )
    )
    

     

1 Reply

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Icon for Community Support rankCommunity Support

    giorgi_lommidd 

     

    You may add the following measure.

    Measure =
    CALCULATE (
        SUM ( Table1[Amount] ),
        FILTER ( ALLSELECTED ( Table1 ), Table1[Date] <= MAX ( DateHelper[Date] ) )
    )