Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

udaykiran
Contributor

List only last 3 dates

Hello All,

I have a requirement where I have to show only last 3 dates of a selected date. For example if I select today's date, the date of today, yesterday and the day before yesterday should be shown in the list box. I have tried using previous function but I am getting undesired results like for some dates when selected, I am getting the last 3 dates available in that field, but for some I am getting last 4 dates available. I am not sure why it is happening.  Please check the attachments for what I did until now and kindly let me know where I am doing wrong and what has to be done.

Thanks in advance.

2 Replies
MVP & Luminary
MVP & Luminary

Re: List only last 3 dates

What do you want to do meant that a calculated dimension needs to be created and those needs expressions with a condition wrapped in a aggr-function, for example something like this:

= aggr(

     only({< %Date = {">=$(=date(max(DateSpecial)-2, 'DD.MM.YYYY'))

                                 <=$(=date(max(DateSpecial), 'DD.MM.YYYY'))"}>} %Date),

   %Date)

whereby DateSpecial a special duplicated date-field in a data-island (loosen table) is then otherwise with only one date-field the selection and their reduced listbox-clone will be to affect eachother.

- Marcus

Re: List only last 3 dates

Hi Uday,

I think, that is because of Country,In your example, Some of the Date value (Dt2), having equal date in both Country(UK and Germany)

But some of the Date(Dt2) values having the different date. (E.g 4/7/2015). See the below screen shot.


Capture.JPG



Not sure, But I think, you need Create the Composite Key for Country&Date, if you need Last 3 Date Values.

Community Browser