Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcement: Certain actions are currently causing a Page Not Found error. This is a known issue and we are working with the platform vendor to investigate and resolve it.
Highlighted
Not applicable

Surely this is a simple fix...

...I just can't seem to figure it out!

I have two fields, BeautyParadeDate and SiteVisitDate.

I'd like to do the following;

If both fields are blank then state "Tender", else, state BeautyParade or SiteVisit dependant on which date is greater.

For some reason I cannot get this to work

Can anyone help please?

1 Solution

Accepted Solutions
Not applicable

Re: Surely this is a simple fix...

Nothing seemed to work with this so I had to build a separate indicator field for each status and work it out from there. Thanks anyway people

8 Replies
marcarreras
Valued Contributor

Re: Surely this is a simple fix...

Samuel,

Is this an script issue or are you stacked building an expression? Please post sample as well.

Marc.

Not applicable

Re: Surely this is a simple fix...

I'm trying to achieve it within the script, I've literally got one line of data at the moment with two fields!

Beauty Parade Date Site Visit Date
03/02/2015

If they are both blank then "Tender" else state the one with the max date. The result of the above should say "Site Visit"

Re: Surely this is a simple fix...

Maybe this:

Alt(If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate), 'Tender') as SiteVisit

or

If(IsNull(BeautyParadeDate) and IsNull(SiteVisitDate), 'Tender', If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate)) as SiteVisit

HTH

Best,

S

Re: Surely this is a simple fix...

Tested the following code with some dummy data and it seems to work just as you wanted:

Table:

LOAD * INLINE [

    BeautyParadeDate, SiteVisitDate

    01/01/2015, 12/31/2014

    ,

    03/15/2013, 06/15/2013

];

Table2:

LOAD *,

  Alt(If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate), 'Tender') as SiteVisit

Resident Table;

Best,

S

Not applicable

Re: Surely this is a simple fix...

Must be something odd going on then as I tried these solutions before and all I get is Tender, for some reason the dates are being ignored

Re: Surely this is a simple fix...

May be the dates you are using are picked up by QlikView as text instead of date. You might want to use Date# function if that is the case.

Best,

S

Partner
Partner

Re: Surely this is a simple fix...

As suggested by sunindia, it is working. Please could you add sample code here which you are using .

Not applicable

Re: Surely this is a simple fix...

Nothing seemed to work with this so I had to build a separate indicator field for each status and work it out from there. Thanks anyway people