How to calculate incremental sums with DAX? RRS feed

  • Question

  • I need to display sum of subsribers by days

    For example, If On Monday 3 person subscribed, On tuesday - 2, On Wednasday - 1. I want to display:

    Monday - 3

    Tuesday - 5

    Wednesday - 6

    Ho to do it in the pivot table based on the data in PowerPivot?

    Thursday, December 2, 2010 5:46 PM


  • Hi,

    If you want to calculate accumulated sum, you can use a DAX formula to loop over your data , for example, you have a 'DataTable':

    DateKey   Value   accumulate

    001               3                 3

    002               2                 5

    003               1                 6

    accumulate can be calculated as

    = Calculate(sum('DataTable'[Value]), Filter('DataTable', 'DataTable'[DateKey]  <=earlier('DataTable'[DateKey]) ))

    This makes more sense when you are trying to calculate regarding a numerical or a datetime field

    In your example, the order of strings "Monday", "Tuesday"... is not defined so it does not make much sense to calculate incremental sums


    Friday, December 3, 2010 9:45 PM