cancel
Showing results for
Search instead for
Did you mean:
Regular Visitor

## Previous month date

Hello,

Found a formula at daxpattern for the previous month date

PM Date =
CALCULATE (
MAX ( D_Date[DATE_Date] ),
ALL ( D_Date ),
FILTER (
ALL ( D_Date[DATE_DayNumberInMonth] ),
D_Date[DATE_DayNumberInMonth] <= EARLIER ( D_Date[DATE_DayNumberInMonth] )
|| EARLIER(D_Date[DATE_DayNumberInMonth] ) = EARLIER ( D_Date[DaysInMonth] )
),
FILTER (
ALL ( D_Date[DATE_MonthNumber] ),
D_Date[DATE_MonthNumber]
= EARLIER ( D_Date[DATE_MonthNumber] ) - 1
)
)

but

for some reasons formula return date from the next year instead of current.

day numer and month name is correct.

Why year is a different ?

2 REPLIES 2
Community Support Team

## Re: Previous month date

Hi @slyfox,

Based on my test, you could try this dax formula:

`PM = DATE(YEAR('D-Date'[date]),MONTH('D-Date'[date])-1,DAY('D-Date'[date]))`

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support Team

## Re: Previous month date

Hi @slyfox

could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.