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: 
Anonymous
Not applicable

If statement not returning expected result.

Hi,

I have an expression where if condition/statement not returning expected result. Let me explain in the brief :

Ex: If some field has two value in character of two. one is 'LA' and 'MA' and we are applying the logic in if condition if ( cityname='LA' the count the distinct cityname)

i;e

(if(City='FT' and name<>'Cancelled' or name<>'Failed' and D_I<>'D'and COMP<>'19',count({$<TYPE={'xyz'}> }DISTINCT state )+if (city='FT' and name<>'Cancelled' or name<>'Failed',Count({$<TYPE={'xyz'},COMP={'19'}> }Distinct TICKET)))

here even if we change the City='FT' into 'RT' then also it doesn't changes the value.

Could anyone please help in this regard.

thanks

shubham

3 Replies
swuehl
MVP
MVP

Shubham,

it would be helpful if you could post some lines of sample data together with your expected output, because I haven't understood your requirement completely, so I can't tell if your statement is right or wrong. I only noticed that under ceratin conditions, it looks like you add the count of distinct states to the count of distinct tickets, is this what you want?

Regards,

Stefan

SunilChauhan
Champion
Champion

in place of  use

left(City,2)='FT'

use for all city  as same

hope this helps


Sunil Chauhan
Not applicable
Author

As swuehl already said, its hard to understand how you want your expression to function. However maybe the problem is your condition? Since logical AND is evaluated before logical OR the condition that city='FT'/'RT' is not vaild for thw whole condition.

For example, your first condition is true if any of the following is true: (city='FT' and name='Cancelled') or (name <> 'Failed' and D_I<>'D' and comp<>'19').

Thats my only guess using the information you provided.

Regards