Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Required to put the years in a list box

Hi, I have a situation where the years are not in 'continuity'. For example, in the input data: '1-Jan-1994', '31-Jul-1996', '14-Sep-1999'...etc. It shows that data for a few years are missing.

I need to create a listbox which spans from minimum year to the maximum with all those years that falls in between...for example, I need the output in the list box as: 1994..1995..1996...1997...1998...1999  (though there is no data for 1995, 1997 and 1998)

I have taken min and max of the year in the expression section of the list box...but I am not able to proceed further.

Thank you.


1 Solution

Accepted Solutions
maxgro
MVP
MVP

here for master calendar

http://community.qlik.com/blogs/qlikviewdesignblog/2012/10/16/the-master-calendar

or,  just a small example

SET vMinDate = makedate(1994);

SET vMaxDate = makedate(1999,12,31);

calendar:

load

  date($(vMinDate) + rowno() -1) as d,

  month($(vMinDate) + rowno() -1) as m,

  year($(vMinDate) + rowno() -1) as y

AutoGenerate

  $(vMaxDate) - $(vMinDate) +1;

View solution in original post

3 Replies
Anonymous
Not applicable
Author

If you have Master Calendar in your data model,the years will be listed properly

maxgro
MVP
MVP

here for master calendar

http://community.qlik.com/blogs/qlikviewdesignblog/2012/10/16/the-master-calendar

or,  just a small example

SET vMinDate = makedate(1994);

SET vMaxDate = makedate(1999,12,31);

calendar:

load

  date($(vMinDate) + rowno() -1) as d,

  month($(vMinDate) + rowno() -1) as m,

  year($(vMinDate) + rowno() -1) as y

AutoGenerate

  $(vMaxDate) - $(vMinDate) +1;

Not applicable
Author

Thank you!