Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
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

Hi Sunny,

    This question is related and I know You would know what I am talking about since u wrote these lines for me:

LOAD *,

IF([TIER]='GOLD',

    if([EL_3_]='Yes','SLA MET','SLA Not Met'),

    IF([TIER]='SILVER',

IF([DECODE_PRIORITY]='High' AND [Arrival to Resolve Days]<=3,'SLA MET',

IF([DECODE_PRIORITY]='Urgent' AND [Arrival to Resolve Days]<=3,'SLA MET',

IF([DECODE_PRIORITY]='Medium' AND [Arrival to Resolve Days]<=10,'SLA MET',

IF([DECODE_PRIORITY]='Low' AND [Arrival to Resolve Days]<=20,'SLA MET','SLA Not Met')))))) as SLA;

in the App, only line 1-3 is recognised, the rest of the lines is not being recognised on the App. Can you help me out pls.

sunny_talwar

Can you share a screenshot?

Not applicable
Author

I have attached the app. 

sunny_talwar

When you say this:

only line 1-3 is recognised, the rest of the lines is not being recognised on the App


What exactly do you mean that the line is not recognized?

Not applicable
Author

Open the first Sheet on the app, on the TICKET_CATEGORY pane, if u select every option there except HARP-SUITE,GSP and EDX, u would see the SLA line chart wouldn't move, that's because your selections are all TIER=SILVER and the deselected one are all GOLD.

And u can try vice versa, u would see it will affect the line graph.

sunny_talwar

victor onyebuchi wrote:

Open the first Sheet on the app, on the TICKET_CATEGORY pane, if u select every option there except HARP-SUITE,GSP and EDX, u would see the SLA line chart wouldn't move, that's because your selections are all TIER=SILVER and the deselected one are all GOLD.

I am sorry, but I am still not sure what your expecting to see?? Why is the above wrong is what I don't understand?

Not applicable
Author

Because the line chart shouldn't be 100%, when the SLA is selected, it shows its not recognising the remaining lines of GOLD that the TIER = SILVER.

sunny_talwar

I think I am too tired today... I have no idea what you are saying... You will have to take screenshots and explain with highlighting the issues for me...

Not applicable
Author

Hi Sunny,

  If you look at all the code, you would see that I divided TICKET_CATEGORY into TIER(GOLD and SILVER).

Telling from the line Chart, you would see that my load statement below only applies to when TIER=GOLD and doesn't not have any effect on the line chart, when only SILVER TIER ticket_categories are selected and SLA_MET from the load statement option is selected.. I hope u understand now ??

LOAD *,

IF([TIER]='GOLD',

    if([EL_3_]='Yes','SLA MET','SLA Not Met'),

IF([DECODE_PRIORITY]='High' AND [Arrival to Resolve Days]<=3,'SLA MET',

IF([DECODE_PRIORITY]='Urgent' AND [Arrival to Resolve Days]<=3,'SLA MET',

IF([DECODE_PRIORITY]='Medium' AND [Arrival to Resolve Days]<=10,'SLA MET',

IF([DECODE_PRIORITY]='Low' AND [Arrival to Resolve Days]<=20,'SLA MET','SLA Not Met')))))) as SLA;

Not applicable
Author

Sorry for the disturbances Sunny. Its been my mistake all along. sure u aren't pissed ??