Forum Discussion
Modify DAX fromula PREVIOUSMONTH
Hello all,
I have a report that feeds off current month results. All of the other columns in the table ( CM results vs Budget, CM vs Prior Month, etc) . I would like to add 3 columns , 1 each for the prior 3 months. The formula below works perfect for the priormonth, but I need another to go back 2 months, and 3 months. Any suggestions?
You can use DATEADD
An example would be:
PreviousMonth = CALCULATE(SUM([Actuals]), DATEADD(DateTable[Date], -3, MONTH)
3 Replies
- hnguy71Super User
You can use DATEADD
An example would be:
PreviousMonth = CALCULATE(SUM([Actuals]), DATEADD(DateTable[Date], -3, MONTH)
- Higgs11Frequent Visitor
This worked
I removed the SUM Dax expression since the field was a measure. I created 3 of these and put them in my results table. whats nice is that when the current month changes, the prior 3 months change automatically as well.
Prior 3rd Month =CALCULATE ( [Actuals],DATEADD ( 'DateDim'[Date], -3, MONTH ))Now, only if the column name can be dynamic as well to match the months name. I will research these awesome blogs to see if that's possible.Thank you for the help :)- hnguy71Super User
I'm glad it worked out for you. Open a new thread with the issue and let's see what we can do about that. My first thought is to use Power Query to do that