Forum Discussion

Jcho10's avatar
Jcho10
Frequent Visitor
9 years ago
Solved

Cumulative Sum

Hi everybody,   I'm learning PBI and I would like to create a matrix table to calculate : -In a first column : the total turnover by month -In a second column : the cumulative turnover   I woul...
  • v-haibl-msft's avatar
    9 years ago

    Jcho10

     

    In this scenario, you need to create a Calendar table first with following formula. And create relationship between the Calendar table with the fact table with Date key.

    Calendar = 
    CALENDAR ( "1/1/2015", "12/31/2016" )

     

    Since I don’t know your table structure, I just create a simple fact table as below. The Measure expression for TURNOVER is “TURNOVER = SUM( Table1[Sold] )”.

     

    Then we can create a Measure with following formula to get the cumulative turnover.

    CUMULATIVE TURNOVER = 
    CALCULATE (
        [TURNOVER],
        FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
    )

     

    You can take a look at this document to understand more about Cumulative Sum.

    I've also uploaded my .pbix file here for reference.

     

    Best Regards,

    Herbert