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: 
azmeerrehan
Partner - Creator
Partner - Creator

Customized List Box

In my data set I have Years  like 2018,2017,2016, etc.  I dont want to limit the script for 2018, but on the list box I would like to see only Current  and 3 Prev years, how can I do that ?

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Maybe

=IF(Year >= Year(Now())-3 and Year <= Year(Now()),Year)

View solution in original post

7 Replies
Anil_Babu_Samineni

One best solution this for expression in list box rather direct field

If(Year <> 2018, Year)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

=aggr(if(YearField>= year(addyears(today().-3)) and YearField<= year(today()), YearField),YearField)

suryaa30
Creator II
Creator II

Create below variables:

vNow: Date(max(TOTAL DateYearField))

vPrev3: $(vNow)-AddYears($(vNow),-3)

Then in list box use below condition. in drop down select expression at the bottom most.

=if(($(vNow) - DateYearField))>0) and ($(vNow) - DateYearField))<= $(vPrev3)),DateYearField)

LB.PNG

antoniotiman
Master III
Master III

Maybe

=IF(Year >= Year(Now())-3 and Year <= Year(Now()),Year)

azmeerrehan
Partner - Creator
Partner - Creator
Author

Syntax does not look right

Kushal_Chawda

Or try this

AGGR(If(YEAR>= year(today()) - 3 and YEAR <=year( today()), YEAR), YEAR)

passionate
Specialist
Specialist

Simple way to do this is using calculated expression in listbox:

=Valuelist(Year(Today()),Year(Today())-1,Year(Today())-2,Year(Today())-3)