Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Higgs11
Frequent Visitor

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?

 
ACT LastMonth =
CALCULATE (
    [Actuals.],
    PREVIOUSMONTH( '3_DateDim'[Date] )
)
 
The '3_DateDim'[Date]) in the table defaults to the current month, which is a Y/N filter.
Please note I use a date table common with what users suggest and built relationships.
1 ACCEPTED SOLUTION
hnguy71
Super User
Super User

You can use DATEADD

 

An example would be:

 

PreviousMonth = CALCULATE(SUM([Actuals]), DATEADD(DateTable[Date], -3, MONTH)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

3 REPLIES 3
hnguy71
Super User
Super User

You can use DATEADD

 

An example would be:

 

PreviousMonth = CALCULATE(SUM([Actuals]), DATEADD(DateTable[Date], -3, MONTH)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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 🙂

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



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors