Forum Discussion

WillemC's avatar
WillemC
Resolver I
6 years ago
Solved

rolling sum: empty values in groups

Hi all,   I got a problem I can't wrap my head around. I'm trying to create a rolling sum for the past 12 weeks. I got sales data, which consists out of salesdate, productgroup, amount etc.   I...
  • WillemC's avatar
    6 years ago

    Okay, seems that I found the solution.

    I was using a column value to calculate instead of a measure...

     

    The following measure did what I wanted (except it allready creates a sum for the future 12 weeks)
    But this I could solve by filtering the matrix/graph to end at the current week.

    SUM Last 3M = 
    CALCULATE (
        SUM( Sales[WEIGHT] );
        FILTER(ALL(Datumtabel[Date]);
              Datumtabel[Date] <= MAX(Datumtabel[Date]) 
              &&  
              DATEADD(Datumtabel[Date];84;DAY) >= MAX(Datumtabel[Date]      
        )
         )
          )

     

    Little side note, it's posible to use MIN instead of MAX, then it shows the sum of the previous 12 weeks instead of current + 11 weeks earlier.