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

If Statement bringing up wrong output

Hi All,

   can anyone help me with this codes below:

LOAD*,

   If(Match(TICKET_STATUS, 'WORK IN PROGRESS', 'HOLD', 'ASSIGNED', 'NEW'),

   If(TIER = 'GOLD',

   IF(Now() > TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA','IN_SLA'),

   IF(TIER = 'SILVER',

   IF(DECODE_PRIORITY ='High' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),2),'OUT_OF_SLA',

   IF(DECODE_PRIORITY='Medium' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),7),'OUT_OF_SLA',

   IF(DECODE_PRIORITY='Low' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'), 10),'OUT_OF_SLA','IN_SLA')))))) as OPEN_SLA;

LOAD *,

   If(Match(TICKET_STATUS, 'WORK IN PROGRESS', 'HOLD', 'ASSIGNED', 'NEW'),

   If(TIER = 'GOLD',

   IF(Now() > TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA','IN_SLA'),

   If(TIER = 'BRONZE',

   IF(Now() > LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'), 40),'OUT_OF_SLA','IN_SLA'),

  IF(TIER = 'SILVER',

   IF(DECODE_PRIORITY ='High' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),2),'OUT_OF_SLA',

   IF(DECODE_PRIORITY='Medium' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),7),'OUT_OF_SLA',

   IF(DECODE_PRIORITY='Low' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'), 10),'OUT_OF_SLA','IN_SLA'))))))) as OPEN_SLA;

===================================================================================================

The first LOAD statement works, but the second works but bring up the wrong set of selections and the highlighted line is the only difference between them. stalwar1‌   Sunny pls help me with this. Thanks

32 Replies
Not applicable
Author

The first sheet R&DIT IM DASHBOARD, I renamed the load statement on the sheet as OPEN_TICKET, select IN_SLA, search for the name and select "CLINICAL PRISM" on the TICKET_CATEGORY. you can use the first link on the table  on the sheet as an example. The RESOLVE_BEFORE of the selection has longed past,  but  it is still showing as IN_SLA, which is wrong.

sunny_talwar

Something about RESOLVE_BEFORE date has changed... it seems that it is not a timestamp anymore?

Not applicable
Author

It is showing like this on the server:

Just numbers.

Not applicable
Author

But on another, without that TIER= BRONZE, everything works perfectly.

sunny_talwar

So nothing else changed, but Resolve Before changes if you add the extra if statement? That's strange... can you share a version where without the extra if... everything was working?

Not applicable
Author

Please find the attached.

sunny_talwar

Victor, you are killing me man.....The new application changes RESOLVE_BEFORE

Capture.PNG

Not applicable
Author

Oh NO! sorry for putting you through this, I created the lines of code myself, just forgot I used that field for something else a while back.      Thanks !!!!

sunny_talwar

Don't worry my friend... I was just kiddin

Not applicable
Author

loool Thanks much.

see if you can help me with this thread topic How to make table in qlik sense just 2 colors