Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to create month and year list box?

Hi,

I am VERY new to Qlikview and can't seem to find figure out how to build a list box that ONLY shows "Month" and another box that should "Year".

For example,

My field records for date column are:

2/01/2009

2/14/2009

3/12/2009

4/15/2009

1/10/2010

2/23/2010

3/02/2010

How do I create a list box that ONLY shows "YEAR" such as only 2009, 2010?

How do I create a list box that ONLY shows "Month" such as Jan, Feb, Mar, April?

Thanks in advance!!!!

13 Replies
eliran
Creator III
Creator III

Maybe you scripted it wrong, script should go like this:

TableName:

load

datecolumn,

otherfields,

Year(datecolumn) as Year,

Month(datecolumn) as Month;

This way you will have the original date column and other fields and using the Year and Month functions you will create the additinal required fields.

I hope it helps.

Not applicable
Author

Hi Roland,

See attached Sample. As per your suggestion, I tried creating a list box to show Year(Date) in the expression but I am getting all the rows.

I just want to be able to create a "YEAR" list box that ONLY shows 2 ROWS or "MONTH" that only shows the 4 months:

YEAR

2009

2010

MONTH

JAN

FEB

MAR

APR

Thanks again!!

eliran
Creator III
Creator III

Kali,

I looked at the file you posted, you still lack the the code in order to add the month/year.

add the underlined lines to your code and it should work fine:

LOAD











Item,

date,

Year

(date) as Year,

Month

(date) as Month

FROM

[..\Users\rpalomo\Desktop\sample.xlsx]

(

ooxml, embedded labels);









Not applicable
Author

Just tried it. Thank you!! It worked!!!

Really appreciate both your help!!!