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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Neel98
Frequent Visitor

Dax: Previous Month calculation

Hi Team,

I am trying to create the dax for the Maximum date in the previous month. Could you please share your idea?

Neel98_0-1669282216606.png

 

1 ACCEPTED SOLUTION
NikhilChenna
Skilled Sharer
Skilled Sharer

Hi @Neel98 , 
Hope you have a datedimension table in your data set, if not create that first and create a one to many relationship from your date table to this table and create the below measure. 


CALCULATE( 
          MAX(Report Date),
          DATEADD('Date Dimension'[date],-1,MONTH)
)

 

Regards,
Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
NikhilChenna
Skilled Sharer
Skilled Sharer

Hi @Neel98 , 
Hope you have a datedimension table in your data set, if not create that first and create a one to many relationship from your date table to this table and create the below measure. 


CALCULATE( 
          MAX(Report Date),
          DATEADD('Date Dimension'[date],-1,MONTH)
)

 

Regards,
Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

month = CALCULATE(MAX('date'[Date]), PREVIOUSMONTH('date'[Date]))
  • MAX('date'[Date]): This function calculates the maximum date from the 'Date' column of your 'date' table.
  • PREVIOUSMONTH('date'[Date]): This function returns a table containing dates from the previous month, considering all dates in the 'Date' column of your 'date' table.
  • CALCULATE: This function evaluates an expression in a modified filter context.

So, when you use CALCULATE with MAX and PREVIOUSMONTH, you're instructing Power BI to calculate the maximum date from the previous month based on the dates in your 'date' table. Your measure will dynamically adjust as the current month changes, always showing the maximum date from the previous month.

This DAX measure should work effectively for your requirement.

 

Anuja_Chaudhari_0-1707219548351.png

in my data set  upto 31 jan 2024 data have . so..

Anuja_Chaudhari_1-1707219589874.png

max prevoius month  should be 31 dec 2023 

 hope this alternative  is userful for you 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)