Forum Discussion

Lenastray's avatar
Lenastray
Helper I
7 years ago
Solved

Help previous sum

Hello. For calculating the cumulative total I make use of the following dax pattern:   CALCULATE ( SUM ( Table[numericValue] ), ALLEXCEPT ( Table, Table[Dates], Table[Attribute1], T...
  • OwenAuger's avatar
    7 years ago

    Lenastray

    Something like this should work. All I've done is change the first argument of the CALCULATE function to a further CALCULATE, with Table[Dates] filtered to the latest date subject to the filters of the outer CALCULATE. Also removed Dates from ALLEXCEPT.

     

    =
    CALCULATE ( CALCULATE ( SUM ( Table[numericValue] ), LASTDATE ( Table[Dates] ) ), ALLEXCEPT ( Table, Table[Attribute1], Table[Attribute2] ), Table[Dates] < EARLIER ( Table[Dates] ) )

    Regards,

    Owen