Forum Discussion
Dax DatesInperiod function
Good day, I want to get the mobile sum of 12 months from the last output of items from the warehouse I am using the Datesinperiod function when executing it does not mark me error but the values it shows me are the total outputs of each article does not summarize me only the outputs of the last 12 months, I'm already working with a unique date table ReportDates[ReportDate]
Annex formula
Salidas12MM = Calculate(sum(TransactionItems[QTY]),filter(TransactionItems,
DATESINPERIOD(ReportDates[ReportDate],
MAX(ReportDates[ReportDate]),-12,MONTH)))
I will appreciate help in this regard
1 Reply
- krishb1414Helper III
Hi Syndicate_Admin You can use DATEADD to calculate sales for Last 12 Months.
Last 12 Months = CALCULATE(SUM(sales), DATEADD(date,-12,MONTH))
or else you want rolling 12 months then try this
Rolling 12 Months =
MaxDate = MAX(MONTH(date)) or MONTH(TODAY())
MinDate = MAX(MONTH(date)) - 12 or MONTH(TODAY()) - 12
RETURN
CALCULATE(SUM(Sales),
FILTER(date,
date <= MaxDate && date >= MinDate ))
Thanks