Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
btrompetter
Contributor III
Contributor III

Two ListBoxes with Year and Month not working

Hello

I have a YearMonth field (eg. 200901) from my datasource and want to create two ListBoxes one to select the year and another one to select the month.

The year ListBox has the function: =Year(MakeDate(left(JAHRMONAT,4), right(JAHRMONAT,2)))

and the month ListBox has the function =Month(MakeDate(left(JAHRMONAT,4), right(JAHRMONAT,2)))

I can select a year and the month are filtered but when I try to filter both the years filter was dropped. E.G. I select a year hold down the CTRL key and then selelect a month. Then is the month green but the year filter is dropped.

Is there a possibility to filter with both list boxes?

regards

Bastian

1 Solution

Accepted Solutions
Anonymous
Not applicable

Bastian,

The problem is that when you make a selection in a calculated list box, you're actually selectin g values of the underlying fields. The same field is used in both boxes, so you simply making a new selection, not adding to the existing one.
The right thing to do is to separate the JAHRMONAT into two separate fields, Month and Year.
The wrong thing to do (if your prefer so) is to create one calculated list box for Month-Year, something like this:
month(makedate(left(JAHRMONAT 4), right(date,JAHRMONAT))) & '-' & left(JAHRMONAT,4)

View solution in original post

4 Replies
Anonymous
Not applicable

Bastian,

The problem is that when you make a selection in a calculated list box, you're actually selectin g values of the underlying fields. The same field is used in both boxes, so you simply making a new selection, not adding to the existing one.
The right thing to do is to separate the JAHRMONAT into two separate fields, Month and Year.
The wrong thing to do (if your prefer so) is to create one calculated list box for Month-Year, something like this:
month(makedate(left(JAHRMONAT 4), right(date,JAHRMONAT))) & '-' & left(JAHRMONAT,4)

Not applicable

Dear Bastian,

It is not possible to use two separate list boxes on a single source data field. Also the Current Selections box will show the selection based on the source data field (JAHRMONAT). You should separate the field in your reload script, like this:


LOAD
Year(MakeDate(left(JAHRMONAT,4), right(JAHRMONAT,2))) AS Year,
Month(MakeDate(left(JAHRMONAT,4), right(JAHRMONAT,2))) as Month


Good luck!

regards Mark

johnw
Champion III
Champion III


Michael Solomovich wrote:The right thing to do is to separate the JAHRMONAT into two separate fields, Month and Year.
The wrong thing to do (if your prefer so) is to create one calculated list box for Month-Year


Right and wrong approaches for dates depend heavily on the application. If you want to compare specific months across years, it's easier to split apart Month and Year fields. But if you want to show a trend report by month for three years, it's easier to do that with a Month-Year field. In my applications at least, I much more often want months like "Jan 09" than simply "January", and I don't consider this wrong, as it is appropriate for my applications.

Anonymous
Not applicable

John,
My "wrong" qualifier is specific for the current situation. In fact, I always create Month-Year field - to the additon of "normal" Year, and Month fileds.