cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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?

1 ACCEPTED SOLUTION
Continued Contributor

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),
)

Regards,
Nikhil Chenna

Appreciate with a Kudos!! (Click the Thumbs Up Button)

2 REPLIES 2
Continued Contributor

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),
)

Regards,
Nikhil Chenna

Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helper I
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.

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

max prevoius month  should be 31 dec 2023

hope this alternative  is userful for you

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors