Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
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
MVP
MVP

Re: Show Year in list box (after certain date)

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

Re: Show Year in list box (after certain date)

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?

MVP
MVP

Re: Show Year in list box (after certain date)

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

Re: Show Year in list box (after certain date)

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.
Not applicable

Re: Show Year in list box (after certain date)

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

Re: Show Year in list box (after certain date)

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

Re: Re: Show Year in list box (after certain date)

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.