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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
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?

1 Solution

Accepted Solutions
sunny_talwar

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

May be this:

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

Anonymous
Not applicable

MayilVahanan

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

Try this:

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

MayilVahanan

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

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.