Forum Discussion
Dax Sales by Period
Good afternoon,
I have the formula below that is already correct taking the last 30 days
Last 30 Days = CALCULATE (SUM (Table [Total]); DATESINPERIOD (Table [Date]; MAX (Table [Date]);
This formula returns me the sum of the sales of the last 30 days, for example, the sales of the day 9/08 retroactive until the day 11/07.
The formula that I need is to pick up the sales from day 31, day 32, day 33 and so on until the 60 day that in my case is 10/06.
Did you get it?
Tanks
Hi ricardo_cvo,
Yes, you can use the DATESINPERIOD function to calculate the sum sales in a period. You can change the interval parameter, the following first formula calculates the total sum from last 31 days until the last date of your date, the second one calculates the total sum from last 60 days until the last date of your date.
Last 31 Days =
CALCULATE (
SUM ( Table[Total] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -31, DAY )
)
Last 60 Days =
CALCULATE (
SUM ( Table[Total] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -60, DAY )
)
Best Regards,
Angelia
- ricardo_cvo8 years ago
Helper I
Thanks for the answer
I did the calculation however is coming a value much higher for the calculation of 60 days what could be?
Regards