Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
debmsarkar123
Contributor III
Contributor III

Find the third field if two fields have non zero values

My dataset -

A B C
abc 0 12
ert 0 45
ghj 14 0
kli 56 78
qas 0 0

 

I want to find the values of A for which values of B and C together are non-zero.

Expected output-

A B C
kli 56 78
Labels (3)
5 Replies
Or
MVP
MVP

Load A, B, C

From YourTable

Where B <> 0 and C <>0;

You could probably just use B*C <> 0 too.

debmsarkar123
Contributor III
Contributor III
Author

Hi,

Thanks for replying.  I was looking for a more set analysis  solution  as in the actual scenario, loading with these conditions might not be feasible.

Or
MVP
MVP

Well, a simple if() would work here if that's okay.

If(B<>0 AND C<>0,B) and likewise for C, with "Include zero values" disabled.

I'm not sure how why you would plan to use set analysis here considering there's no aggregation being made, but you could probably use Only({< B -= {0}> * <C -= {0} >} B) with * being the intersect of the two sets.

MarcoWedel

another set expression could be:

{$<A={"=B<>0 and C<>0"}>}

 

marcus_sommer

It's not solvable with a classical set analysis because your tasks requires a row-evaluation. If I had this task I would probably apply it as a boolean factor, like:

sum(VALUE) * sign(B * C) // by possible negative values fabs(sign(B * C))

- Marcus