Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What NOW() function will output??

stalwar1s@@@@@who knows what the now function used below in my expression will produce??

IF(TICKET_STATUS = 'WORK IN PROGRESS' OR TICKET_STATUS='HOLD' OR TICKET_STATUS='ASSIGNED' OR TICKET_STATUS='NEW',

IF(TIER='GOLD' AND NOW()>RESOLVE_BEFORE,'OUT_OF_SLA','IN_SLA'),

IF(TIER='SILVER',

IF(DECODE_PRIORITY ='High' AND (NOW()+2)>RESOLVE_BEFORE,'OUT_OF_SLA',

IF(DECODE_PRIORITY='Medium' AND (NOW()+7)>RESOLVE_BEFORE,'OUT_OF_SLA',

IF(DECODE_PRIORITY='Low' AND (NOW()+10)>RESOLVE_BEFORE,'OUT_OF_SLA','IN_SLA')))))

I want the number(2) in  (NOW()+2) to be in DAYs and not HOURS??

e.g NOW()+2DAYS

92 Replies
sunny_talwar

Try this:

LOAD *,

    IF(TICKET_STATUS = 'WORK IN PROGRESS' OR TICKET_STATUS='HOLD' OR TICKET_STATUS='ASSIGNED' OR TICKET_STATUS='NEW',

IF(TIER='GOLD' AND NOW() > TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA','IN_SLA'),

IF(TIER='SILVER',

IF(DECODE_PRIORITY ='High' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT')+2),'OUT_OF_SLA',

IF(DECODE_PRIORITY='Medium' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT') +7),'OUT_OF_SLA',

IF(DECODE_PRIORITY='Low' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT') + 10),'OUT_OF_SLA','IN_SLA'))))) AS OPEN_SLA;

Essentially replace RESOLVE_BEFORE with TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT')

Not applicable
Author

Thanks Sunny, it works. I which to be as intelligent as u some day

sunny_talwar

Hahahaha I am sure you will be. Please consider marking any helpful responses.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

Not applicable
Author

Hi Sunny,

    The condition isn't not producing the result I expected, someone told me to use else if condition, but it seems Qlik Sense script doesn't recognise it. I used this;

LOAD *,

    IF(TICKET_STATUS = 'WORK IN PROGRESS' OR TICKET_STATUS='HOLD' OR TICKET_STATUS='ASSIGNED' OR TICKET_STATUS='NEW',

    IF(TIER='GOLD' AND NOW() > TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA',

     else IF(TIER='SILVER',

    IF(DECODE_PRIORITY ='High' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT')+2),'OUT_OF_SLA',

    else IF(DECODE_PRIORITY='Medium' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT') +7),'OUT_OF_SLA',

    else IF(DECODE_PRIORITY='Low' AND NOW()>(TimeStamp#(RESOLVE_BEFORE, 'MMMM DD, YYYY hh:mm:ssTT') + 10),'OUT_OF_SLA','IN_SLA'))))) AS OPEN_SLA;

how on earth do I modify this ??

sunny_talwar

Yes, there is no ELSEIF in Qlik products... Would you be able to share few rows where the expected output doesn't match based on the fields from the above condition?

Not applicable
Author

in my first condition where it says "IF(TICKET_STATUS = 'WORK IN PROGRESS' OR TICKET_STATUS='HOLD' OR TICKET_STATUS='ASSIGNED' OR TICKET_STATUS='NEW'"

it completely ignores and selects TICKET_STATUS that are already RESOLVED and CLOSED.

sunny_talwar

Can you create a table with these fields

1) TICKET_STATUS

2) TIER='GOLD'

3) RESOLVE_BEFORE

4) DECODE_PRIORITY

5) OPEN_SLA

and highlight those rows where OPEN_SLA is not correct?

Not applicable
Author

TICKET_STATUS   RESOLVE_BEFORE     DECODE_PRIORITY

closed                     

The fact that it brought out a closed TICKET_STATUS as OUT_OF_SLA output, all other fields wouldn't be correct, because it has ignored my first condition of TICKET_STATUS being either "WORK-IN-PROGRESS" OR "NEW".

I hope u understand??

Not applicable
Author

And I could share the app if u want ??

sunny_talwar

Yes, can you share the app?