Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Next Months from Current Selected Month

Hi,

Can someone tell me that how can i get next 4 months based on my current selected month?

For e.g. current selected month is Oct2017 and it should give me Nov2017, Dec2017, Jan2018, Feb2018

Thanks

1 Solution

Accepted Solutions
OmarBenSalem

just replace > with >= ...

sum({<Date=,MonthYear=,

MonthYear={">=$(=max(MonthYear)) <=$(=addMonths(max(MonthYear),4))" }>}Measure)

View solution in original post

8 Replies
OmarBenSalem

suppose you have a date field, a year Month field; if u want to select a Month and have the next 4; do sthing as follow:

sum({<Date=,MonthYear=,

MonthYear={">$(=max(MonthYear)) <=$(=addMonths(max(MonthYear),4))" }>}Measure)

OmarBenSalem

and please take a look at my answer here:; it could help u:

What is missing here to show Rolling 13 months ?

and here:

YTD, MTD issue

Anonymous
Not applicable
Author

try this

DATE(AddMonths(Data, 1), 'MMM YYYY')&'

'&DATE(AddMonths(Data, 2), 'MMM YYYY')&'

'&DATE(AddMonths(Data, 3), 'MMM YYYY')&'

'&DATE(AddMonths(Data, 4), 'MMM YYYY')

Anonymous
Not applicable
Author

Hi,

This below expression is working fine but showing only next 4 months from current selected month. And i want that my selected month should also show. If i select Oct2017 then, In my chart is would show me next 4 months along with current selected month. i.e. (Oct2017, Nov2017, Dec2017, Jan2018, Feb2018)

sum({<Year=,Month=,monthyear={">$(=max(monthyear)) <=$(=addMonths(max(monthyear),4))" }>}Measure)

How i can get that in this expression?

Please guide

Thanks

OmarBenSalem

just replace > with >= ...

sum({<Date=,MonthYear=,

MonthYear={">=$(=max(MonthYear)) <=$(=addMonths(max(MonthYear),4))" }>}Measure)

Anonymous
Not applicable
Author

Perfect!

Thanks

OmarBenSalem

Good !

If your question has been aswered, please don't forget to close the thread by marking the correct answer as correct.

vatsalajmera
Contributor
Contributor

Hi, 

Can you please explain what does the Date and monthyear field mean? Are these the fields related to the dates filed in my data and i just need to replace the "Date" and ''Monthyear" with my date field?

also what does this part (<Date=,MonthYear=,MonthYear=) mean in the set analysis, can you please explain what its doing?