Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
wajihakhan
New Contributor III

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
Esteemed Contributor

Re: Next Months from Current Selected Month

just replace > with >= ...

sum({<Date=,MonthYear=,

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

8 Replies
OmarBenSalem
Esteemed Contributor

Re: Next Months from Current Selected Month

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
Esteemed Contributor

Re: Next Months from Current Selected Month

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

psilva001
Contributor

Re: Next Months from Current Selected Month

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')

wajihakhan
New Contributor III

Re: Next Months from Current Selected Month

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
Esteemed Contributor

Re: Next Months from Current Selected Month

just replace > with >= ...

sum({<Date=,MonthYear=,

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

wajihakhan
New Contributor III

Re: Next Months from Current Selected Month

Perfect!

Thanks

OmarBenSalem
Esteemed Contributor

Re: Next Months from Current Selected Month

Good !

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

vatsalajmera
New Contributor

Re: Next Months from Current Selected Month

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?

Community Browser