Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

frankiegoes2hol
New Contributor III

LOGICAL DISJUNCTION - LOGICAL "OR"

hello everybody.

my question: let's say i have a database with 6 coloumns (i.e. 6 fields) F1, F2, F3, ..., F6 and a N number of entries (rows). i'd like to count any row ONLY IF each one contains a value greater than X. if i was in MS Excel i'd write a formula in a seventh coloumn/field like this: =IF(OR(F1,1>X; F2,1>X);1;0).

how can i translate this in a Qlik expression?

i tried searching the guide but i didn't find anything helpful for me...

thanx

9 Replies

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

HI

Are you asking something like this

=IF(count(N) >  x , Fields)

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

Check with this

Count({<F1={">0"}>+<F2={">0"}>+<F3={">0"}>+<F4={">0"}>+<F5={">0"}>+<F6={">0"}>} F1)

MVP
MVP

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

Maybe like this to count the records with this condition

=sum(if(-rangesum(F1>X,F2>X,F3>X,F4>X,F5>X,F6>X)=6,1,0))

with X being a variable in QV (or replace with a constant number to compare).

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

You can use stephen (swuehl) suggestion also. With little change based on your requirement

=sum(if(-rangesum(F1>X,F2>X,F3>X,F4>X,F5>X,F6>X)>0,1,0))

MVP
MVP

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

These expressions are not equivalent, because the requirement is IMHO not clear.

Mine should return the count of records where all fields (F1 to F6) are showing values > X, while the set expression or the last one should return the count of records where any Field show a value larger X.

It's probably a matter of how to interprete the OP request. I was focusing on

"i'd like to count any row ONLY IF each one [added here: field] contains a value greater than X"

and interpreted this according to my first statement (all fields > X).

Looking at the Excel function, you might conclude something else.

Stefan

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

Hi Stefan,

Yes. You have written based on your understanding (All rows greater than X) which is perfect.

I interpret his requirement as any rows greater than X. So I changed based on that.

And this type of expression long time ago I learned from your post only but i didn't thought of here.

Thanks

Celambarasan

frankiegoes2hol
New Contributor III

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

hi! thank you everybody!

i meant that i'd like to count a record (row) only if one or more fields contain values greater than X (X is a numeric value). thinking at the logical OR as a "+" and at the logical AND as a "*" i'd say Celambarasan Adhimulam's answer is the nearest to my need... but i'm gonna try and let you know...

frankiegoes2hol
New Contributor III

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

no way, tried "copy and paste" with your formulas but none worked... i'd like to create an expression to use like a filter in a multibox object; i'd like this expression to count 1 if one or more fields of each row contains a value greather than  given "X"... that's all, a logical "OR"...

MVP
MVP

Re: LOGICAL DISJUNCTION - LOGICAL "OR"

The expressions worked for me in principal.

Maybe 'X', or the way you define it, is an issue here? How do you define it?

Or is 'X' another field? If so, how is this field linked to the other fields?

Community Browser