6 Replies Latest reply on Feb 11, 2018 9:45 PM by Aman Singh

# Last day of previous month

Hi Guys,

I want to show in my dashboards always last day of previous month automatically. Month(Today())-1 gives me last day month number. How can I get last month last date, in my case its 1/31/2018

• ###### 1. Re: Last day of previous month

Are you looking for this

DATEADD( 'day', -1, MAKEDATE(YEAR([Order Date]), MONTH([Order Date]),1))

1 of 1 people found this helpful
• ###### 2. Re: Last day of previous month

I have date like this

for this month I want to show 1/31/2018.

• ###### 3. Re: Last day of previous month

I think, I did not understand "for this month I want to show 1/31/2018"

Are you saying

If date is from feb 2018, you want to show  jan 31 2018

else you want to show exact date.

• ###### 4. Re: Last day of previous month

yes

• ###### 5. Re: Last day of previous month

I will modify above calculation like below

If YEAR(TODAY()) = YEAR([Order Date])  and MONTH(TODAY()) = MONTH([Order Date]) then

DATEADD( 'day', -1, MAKEDATE(YEAR([Order Date]), MONTH([Order Date]),1))

else [Order Date]

end

Can you have sample workbook?

• ###### 6. Re: Last day of previous month

Hi Roisha,

Try with this Date calculation.

For  Last day of last month.

DATE(DATETRUNC('month',[Order Date])-1)

Regards

Aman