Forum Discussion
Last month
Hi
Could some save me loads of time and point in the right direction of a Calcualtion for adding last months and present months sales. I am using a data table
| Sales | Calcualtion | |
| Month 1 | 200 | 200 |
| Month2 | 300 | 500 |
| Month 3 | 500 | 1000 |
Many thanks
Tim
Hi tmears
That depends ...When does your calculation start ? In the first month of a year/quarter ... ? Or is it dynamic ?
If it is dynamic AND you have a calendar table....
CALCULATE(
SUM(Table[Sales]),
FILTER(
CalendarTable,
Table[Date] <= MAX (CalendarTable[Date]) &&
Table[Date] >= MIN (CalendarTable[Date])
)
)
You might need to change the "FILTER(CalendarTable .... " to "FILTER(ALL(CalendarTable .... " depending on your needs (context)
If it's not dynamic ....
TOTALYTD(SUM(Table[Sales]), Table[Date])
1 Reply
- vcastello
Resolver III
Hi tmears
That depends ...When does your calculation start ? In the first month of a year/quarter ... ? Or is it dynamic ?
If it is dynamic AND you have a calendar table....
CALCULATE(
SUM(Table[Sales]),
FILTER(
CalendarTable,
Table[Date] <= MAX (CalendarTable[Date]) &&
Table[Date] >= MIN (CalendarTable[Date])
)
)
You might need to change the "FILTER(CalendarTable .... " to "FILTER(ALL(CalendarTable .... " depending on your needs (context)
If it's not dynamic ....
TOTALYTD(SUM(Table[Sales]), Table[Date])