Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I need help creating a button to select last month only

I created a button that would select the last week of information using select in field with a field of Week and a search string of

=(Week(today(1))-1)

I also created a button to select the current year using select in field with a fiend of Year and a search string of

=(Year(today(1)))

I also tested it to select last year using a search string of =(Year(today(1))-1)

However using the same format to select last month doesn't work.

Using Month as the field and a search string of =(Month(today(1))-1) it selects nothing.

If I use =(Month(today(1))) I get the current month (as I do if I replace the 1 with a 0 or -1)

How do I make this button select last month?

Thanks all.

1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

=Month(AddMonths(Today(), -1))


Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

5 Replies
krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below expression

=Month(Today()-1)

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

=Month(AddMonths(Today(), -1))


Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Anil_Babu_Samineni

Are you sure, above all working? If yes, month should work. Can you please share the application where do you applying this. We can have a look

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Thank you Aurelian.

This is the solution I needed. Works perfectly.

Thank you.

dhasharadh
Creator III
Creator III

I have the similar requirement, but my Month filter is in diff format like YYYY-MM and I want to select last month every time.

my month filter name is GasMonth. =Month(AddMonths(Today(), -1)) this is not working in my case, please help me.