Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show Year in list box (after certain date)

Dear Community,

I have a year list from 2010 until 2015, user requests to show data where the year is THISyear onward, with the condition if today is greater than 1-Apr.

For example:

If today is 31-March-2014, the year list box will show 2013, 2014 and 2015

If today is 2-April-2014, the year list box will show 2014 and 2015 only

This expression in listbox is not working:

=if(Date(Today(Date), 'ddMMM') >= Date(0401, 'ddMMM') , Year)

Anyone could help?

Thanks and best regards,

Chanel

Extra:

Original Year list box:

but what we need is

(if today (31-March) is lesser than 1-Apr)

or

(if today (2-Apr) is greater than 1-Apr)

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do it. Use as a calculated dimension.

=Aggr(if(Today() >= MakeDate(Year, 4, 1) , Year))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks Jonathan for fast response!

But seems to have little error on aggr function.

I tried with =Aggr(if(Today() >= MakeDate(Year, 4, 1) , Year), Year), but also not working.

Could you please help?

jonathandienst
Partner - Champion III
Partner - Champion III

Chanel

I did make a mistake there - but your correction looks right to me, so I can't say why its not working. If you put the expression into a list box, you can see what values it is producing.

Try using Today(1) as well.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrashantSangle

Hi,

Try Jonathan Expression without aggr()

Like

=if(Today() >= MakeDate(Year, 4, 1) , Year)

Regards

PS

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Hi PS,

=if(Today() >= MakeDate(Year, 4, 1) , Year) will give me result below:

but what i need is

(if today (31-March) is lesser than 1-Apr)

or

(if today (2-Apr) is greater than 1-Apr)

Thanks,

Chanel

Not applicable
Author

Hi Jonnathan,

The Aggr is working but gave me result below:

but what i need is

(if today (31-March) is lesser than 1-Apr)

or

(if today (2-Apr) is greater than 1-Apr)

Thanks,

Chanel

PrashantSangle

Hi,

this statement work properly at my side,

if(Today() < MakeDate(Year, 4, 1) , Year)

Please find attachment

Regards,

PS

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂