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: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

addmonths query

Hi All

i cant get something working.

If a user was to select a fiscal year of 2016, then i want the text box to show the sum(sales) but for the previous year but the following month based on todays date.

=Sum({<[Fiscal Year]= {$(=max([Fiscal Year])-1)}, Month={$(=Date(Date#(Month(today())+1, 'MM'),'MMM'))}>}[Sales])


Can anyone help?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this:

=Sum({<[Fiscal Year] = {$(=Max([Fiscal Year])-1)}, Month={'$(=Num(Month(AddMonths(Today(), 1))))'}>} Sales)

View solution in original post

7 Replies
sunny_talwar
MVP
MVP

May be this:

=Sum({<[Fiscal Year] = {$(=Max([Fiscal Year])-1)}, Month={'$(=Month(AddMonths(Today(), 1)))'}>} Sales)

Anonymous
Not applicable

MayilVahanan
MVP
MVP

Hi

Try like this

=Sum({<[Fiscal Year] = {$(=Max([Fiscal Year])-1)}, Month={'$(=Month(AddMonths(Today(), 1)))'}>} Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

that doesnt work but i think its because my month field is in the number format. i.e.

1

2

3

4

5

etc

sunny_talwar
MVP
MVP

Try this:

=Sum({<[Fiscal Year] = {$(=Max([Fiscal Year])-1)}, Month={'$(=Num(Month(AddMonths(Today(), 1))))'}>} Sales)

MayilVahanan
MVP
MVP

Hi

Then Change Month to Number by using Num() function

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

Hi

Sunny is too fast to reply

Please follow sunny suggestion.

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