Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

<> condition issue

Hi everyone,

      i have a problem with the condition <> in a count expression.

The expresion is this:

count(distinct(if(USERS_ALL.u_email <> SUBSCRIPTIONS_DISTINCT.email, USERS_ALL.u_email)))

and for example, in both tables there is a value like 'gerardo@hotmail.com' but i dont know why the last expression include this value.

What im doing wrong?

Thanks

gerardo

1 Solution

Accepted Solutions
swuehl
MVP
MVP

gerardo,

it seems to me that your tables are not linked, right?

So your embedded if() statement is implicitely building an embedded table containing all combinations of u_email and email. In you have more than one distinct email values, I guess your comparison will return all distinct u_email values.

I think something like this might solve your problem better:

=count(distinct {<USERS_ALL.u_email -= p(SUBSCRIPTIONS_DISTINCT.email) > } USERS_ALL.u_email)

View solution in original post

7 Replies
swuehl
MVP
MVP

gerardo,

could you tell us a bit more about the two tables and how they are linked? Would be best if you could post some sample lines of data.

Thanks,

Stefan

Not applicable
Author

Maybe: if(USERS_ALL.u_email <> SUBSCRIPTIONS_DISTINCT.email,count(distinct USERS_ALL.u_email))

Not applicable
Author

Hi Swuehl,

    I send you more information about….hope this help to give me a hand….

USERS_ALL:
LOAD email as u_email,
id as %Key_USER_ID,
id as u_user_id
FROM

(
qvd);

SUBSCRIPTIONS_DISTINCT:
LOAD email,
email as %Key_EMAIL,

FROM [..\QVD\SUBSCRIPTIONS.QVD] (qvd)
where is_subscribed = 1;

Thanks

gerardo

swuehl
MVP
MVP

gerardo,

it seems to me that your tables are not linked, right?

So your embedded if() statement is implicitely building an embedded table containing all combinations of u_email and email. In you have more than one distinct email values, I guess your comparison will return all distinct u_email values.

I think something like this might solve your problem better:

=count(distinct {<USERS_ALL.u_email -= p(SUBSCRIPTIONS_DISTINCT.email) > } USERS_ALL.u_email)

Not applicable
Author

thanks swuehl, so.....this count all emails in USERS_ALL table which are not present in SUBSCRIPTIONS_DISTINCT table? dont you?

and if i want to count all emails present in both tables?

swuehl
MVP
MVP

Just remove the minus sign (set expression exclusion operator)

=count(distinct {<u_email = p(email) > } u_email)

Not applicable
Author

well, i thought the minus sign was a type error because the editor expresion underline it in red.....but im wrong, because the expresion is ok.

now, the values looks well....

thanks a lot....

gerardo