Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaveshp90
Creator III
Creator III

How to set expression to check the last 30 days?

Hello,

How Can I set the expression to my date column, so that it will filter only for the Last 30 days?

15 Replies
bhaveshp90
Creator III
Creator III
Author

I tried using your expression, but the data is changing when I change the List Box filters

sunny_talwar

You mean that when you select Snapshot_Date the data changes? Try this may be

Sum({<Snapshot_Date = {">=$(=Date(Addmonths(Max({1} Snapshot_Date),-1), 'YYYY-MM-DD'))"}>} Go_Live)

bhaveshp90
Creator III
Creator III
Author

It worked out, but I am getting the last two months data both July and August months data.

Sum({<Snapshot_Date = {">=$(=Date(Addmonths(Max({1} Snapshot_Date),-1), 'YYYY-MM-DD'))"}>} Go_Live)

sunny_talwar

What is your Max Snapshot_Date date? Without knowing what this date, it is difficult to know why you getting July and August

bhaveshp90
Creator III
Creator III
Author

We need to put 0 instead -1 (0 for last month, -1 for two months, ...) here and it worked out. thank you Sunny

Sum({<Snapshot_Date = {">=$(=Date(Addmonths(Max({1} Snapshot_Date),0), 'YYYY-MM-DD'))"}>} Go_Live)

bhaveshp90
Creator III
Creator III
Author

My Max Snapshot_Date is Previous month. If the Current month is October, Max Snapshot_Date is September