Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count of records when value of two fields are not equal

Hi,

I have 3 fields-A,B & C

A is the primary key.

I wrote the expression, count(if(B<>C,A)).

I also tried this: sum(if(B<>C,1,0)).

But , I am getting wrong values with both expressions.

Kindly give your suggestions.

-Anju

2 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=sum(Aggr(if(B<>C,1,0), A))

But it is better to get the same in script.

LOAD

     *,

     if(B<>C,1,0) AS Flag

FROM DataSource;

Now just use Sum(Flag).

Aggr and if() may lead to performance issues.

Regards,

Jagan.

Not applicable
Author

I forgot to add a condition.That was why I was getting the wrong answer.

Sorry!!