Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Maximize ROI with Qlik Professional Services – Expert Guidance, Faster Results: Explore Qlik Services
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

Date Function(Current and Future Dates)

Hi Experts,

Can any one please help me on this.

I have Two fields named Status and Date fields.Those two fields contains the data like

Status

CURRENT

EXPIRED

NONE

Date

10 December 2017

15 February 2018

19 December 2018

11 December 2017

12 December 2017


if Status is None then Date field value should be blank

If Status is current then Date should be current or future date

If Status is expired then Date should be past date

Thanks in advance.

1 Solution

Accepted Solutions
cweiping
Contributor III
Contributor III

10 Replies
supriyabiware
Creator
Creator

try this

create 2 fields-

FutureandCurrDate =if(Date>=today(),Date)

ExpiredDate           =if(Date<today(),Date)

here instead of today() you can put any threshold.

=pick(match(Status,

  'Current',

  'Expired',

  'None'),

    FutureandCurrDate,

    ExpiredDate,

    'Blank'

   )

Thanks

Supriya

Anil_Babu_Samineni

May be this? Qlik is case sensitive

Pick(Match(Status, 'CURRENT', 'EXPIRED', 'NONE'), Date(FutureandCurrDate), Date(ExpireDate), '')

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
vishsaggi
Champion III
Champion III

May be this? Your condition Date >= Today() evaluates to true or false it will not display a date so try like

=if(Match([Status]='CURRENT') AND [Date] >=today(), [Date],

if(Match([Status]='EXPIRED')     AND [Date] <  today(), [Date],

if(Match([Status]='NONE') ,'Blank')))

vishsaggi
Champion III
Champion III

My bad.

Match() function should take two parameters. Like

Match(Status, 'Current') So your expr should be like

=if(Match([Status],'CURRENT') AND [Date] >= today(), [Date],

if(Match([Status],'EXPIRED')     AND [Date] <  today(), [Date],

if(Match([Status],'NONE') ,'Blank')))

Can you share your qvf file if possible so that we can quickly check?

bhavvibudagam
Creator II
Creator II
Author

Hi,

Now expression is Showing OK without error. But not getting the expected output.

Please find the attached app.

Please find the below source file and expected output.

Expected output.png

Thanks,

cweiping
Contributor III
Contributor III

Is it like this?

Ans_284784.png

bhavvibudagam
Creator II
Creator II
Author

Hi,

Yes your correct.Please could you send me the script.

I don't have qlikivew license.

Thanks

cweiping
Contributor III
Contributor III

MD_Status:

LOAD * INLINE [

    Status,seq

    CURRENT,1

EXPIRED,0

NONE,3

];

NoConcatenate

LOAD

     Date,

     sign(sign(Date-today())+1) as seq

FROM

[.\Test.xlsx]

(ooxml, embedded labels, table is Sheet1);

bhavvibudagam
Creator II
Creator II
Author

Hi,

Could you please explain this statement sign(sign(Date-today())+1) as seq

Thanks in advance