Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Prior Month Max Date

Hi All

I have a Date field and would like to get the Max(Date) of the previous month.

Tried this expression but it doesn't work quiet nicely.

Date(Max(AddMonths(Date,-1)),'DD/MM/YYYY').

How can I get this?

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

Sure, see text box

View solution in original post

15 Replies
JoaquinLazaro
Partner - Specialist II
Partner - Specialist II

Hi tstewart

You have two functions MonthStart() and MonthEnd()

Date(MonthEnd(AddMonths(Date,-1)),'DD/MM/YYYY').

Hope this helps you

Joaquín

john_s_w_wood
Creator
Creator

try monthstart(Date)-1

jyothish8807
Master II
Master II

Hi Tumelo,

Try like this:

Max(Date(AddMonths(Date,-1),'DD/MM/YYYY'))

Regards

KC

Best Regards,
KC
Not applicable
Author

try this

=MonthsEnd(1,(date(AddMonths(today(),-1),'DD/MM/YYYY')))

Replace date field with today()

Not applicable
Author

Hi Joaquin

MonthEnd and MonthStart would not help me as I specifically want to consider the last date of each month in the dataset

MayilVahanan

Hi Tumelo,

Try like this

=Date(AddMonths(Max(Date),-1),'DD/MM/YYYY')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

I want the expression to be dynamic e.g if last month's last sales day was 2015/04/28, This is the date I want to see from the expression. When I select any prior date, it should show me that date's previous month last date in the dataset

stigchel
Partner - Master
Partner - Master

Try with

Max({<Date={"<$(=MonthStart(Max(Date)))"}>} Date)

jyothish8807
Master II
Master II

Did you tried my expression? It should work dynamically.

Regards

KC

Best Regards,
KC