Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
t_hylander
Creator
Creator

Show only specific years in listbox

Hi,

I've got a simple listbox with all availble years, what I want is that if a specific cirteria is met only some of the years should show.

Tried using IF-statement in expression under Field, but I cant get it to work.
ex. =if(State='1',Year='2023',Year)

Did som other versions aswell...

Should be fairly simple I think but until you know... 🙂

Labels (3)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

The best way is to use an Aggr() with set analysis. For example

=Aggr(Only({1<State={1}>}Year), Year)

will show the years where State='1'.

Note: This expression should NOT be entered on the expressions tab in the list box properties. It should be entered on the General tab:
General --> Field --> <Expression> (bottom of the list)

View solution in original post

2 Replies
hic
Former Employee
Former Employee

The best way is to use an Aggr() with set analysis. For example

=Aggr(Only({1<State={1}>}Year), Year)

will show the years where State='1'.

Note: This expression should NOT be entered on the expressions tab in the list box properties. It should be entered on the General tab:
General --> Field --> <Expression> (bottom of the list)

t_hylander
Creator
Creator
Author

Ah, ofcourse...makes sense now when I see it 🙂

Thanks, it works like a charm!