1

I have written two types of Running total with dates as below:-

30 days running Total Sales =
CALCULATE (
    [Total Sales],
    FILTER (
        ALL ( Dates ),
        Dates[Date] > MAX ( Dates[Date] ) - 30
            && Dates[Date] <= MAX ( Dates[Date] )
    )
)

and

Running Total =
CALCULATE (
    [Total Sales],
    DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), 30, DAY )
)

I am trying to Calculate 30days running total of Total sales. But both of the queries give the different result as Below.

Can anybody explain ......

enter image description here

Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
dan_karan
  • 27
  • 3

1 Answers1

1

The values MAX ( Dates[Date] ) and LASTDATE ( Dates[Date] ) should be the same here.

The difference is that your first measure is subtracting 30 days whereas the second is adding 30 days.

Try using -30 instead of 30 in the second one.

Alexis Olson
  • 38,724
  • 7
  • 42
  • 64