Forum Discussion
btalahmbong
9 years agoAdvocate II
Create Column with Last 3 Months
Hi, I have a date column and I am trying to create a calculated column that contains the dates from current date and shifts back 3 months. So far I noticed it is possible to use DATESBETWEEN or D...
Datatouille
9 years agoSolution Sage
Hi btalahmbong
DatesBetween and DatesinPeriod both return tables and not a scalar value.
As a result, you cannot use the functions "alone' (except when using DAX as a query language to create new tables) in measures or calculated columns.
But you can use these tables as filter arguments to Calculate yes.
For example, this measure:
SalesLast3Month = Calculate ([Total Sales],DATESINPERIOD('All Stations'[Date],TODAY(), -3,MONTH))returns the total sales of the last three months.
Measures automatically adapt to filter context and make your calculations dynamic!
- Datatouille9 years agoSolution Sage
- btalahmbong9 years agoAdvocate II
For now, I'm creating new measures filtered by last 3 months. I'll keep on playing with it and see if I can find a way to create a column that acts as a 3 monh filter.