Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
wajihakhan
Contributor III
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
Partner
Partner

just replace > with >= ...

sum({<Date=,MonthYear=,

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

View solution in original post

8 Replies
OmarBenSalem
Partner
Partner

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
Partner
Partner

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
Creator
Creator

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
Contributor III
Contributor III
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
Partner
Partner

just replace > with >= ...

sum({<Date=,MonthYear=,

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

wajihakhan
Contributor III
Contributor III
Author

Perfect!

Thanks

OmarBenSalem
Partner
Partner

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?