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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
StuartOxley
Contributor II
Contributor II

Last two months only

Hi 

I'm trying to show the results of the last two months not including the current month.

I can get the last 4,5 & 6 months by using the following:

sum({<

Month,Date={"<=$(=Date(AddMonths(Now(),-3)-1, 'DD/MM/YYYY'))>=$(=Date(AddMonths(Now(), -4-1), 'DD/MM/YYYY'))"},

I cannot get the last 2 & 3 months and get 1, 2 & 3 months when I use: 

Sum( {<

Month,Date={"<=$(=Date(AddMonths(Now(),-1), 'DD/MM/YYYY'))>=$(=Date(AddMonths(Now(), -3), 'DD/MM/YYYY'))"},

Can someone tell me how I can do this please?

KR

Stuart

Labels (2)
1 Solution

Accepted Solutions
MatheusC
Specialist III
Specialist III

Hi, @StuartOxley 

Try something like
Sum({<Month,Date={">=$(=MonthStart(AddMonths(today(),-2)))<=$(=MonthEnd(AddMonths(today(),-1)))"}>} sales)

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

4 Replies
MatheusC
Specialist III
Specialist III

Hi, @StuartOxley 

Try something like
Sum({<Month,Date={">=$(=MonthStart(AddMonths(today(),-2)))<=$(=MonthEnd(AddMonths(today(),-1)))"}>} sales)

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
StuartOxley
Contributor II
Contributor II
Author

Hi @MatheusC that has worked perfectly, awesome! 

Thank you

StuartOxley
Contributor II
Contributor II
Author

Hi @MatheusC 

Can you tell me how I can enter this from todays date please? 

MatheusC
Specialist III
Specialist III

I only inserted today(1) next to the date conversion

$(=Date(Today(1),'DD/MM/YYYY'))

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!