Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

Set Analysis Field1 less than Field2

Hello,

I'm trying to do a very simple expression where I need to count the distinct Customer when Field1 values are LESS THAN Field2 values.

Field1   Field2

2          3

Count(distinct {$<Field1 = P({1<Field1={}>}Field2)>}Customer)

Thank you.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Set Analysis Field1 less than Field2

A correct solution is depending on your data model, so I assume the most simple one, all fields Customer, Field1 and Field2 in one table and only one combination per Customer.

Maybe like this:

=count( {$<Customer = {"=Field1<Field2"}>} DISTINCT Customer)

or similar without using set analysis (and with less restrictions to your data model):

=count(DISTINCT  if( Field1 < Field2, Customer))

4 Replies
chematos
Valued Contributor II

Re: Set Analysis Field1 less than Field2

Count(distinct {$<Field1 = {'<$(=Field2)'}>}Customer)

Highlighted
MVP
MVP

Re: Set Analysis Field1 less than Field2

A correct solution is depending on your data model, so I assume the most simple one, all fields Customer, Field1 and Field2 in one table and only one combination per Customer.

Maybe like this:

=count( {$<Customer = {"=Field1<Field2"}>} DISTINCT Customer)

or similar without using set analysis (and with less restrictions to your data model):

=count(DISTINCT  if( Field1 < Field2, Customer))

Not applicable

Re: Set Analysis Field1 less than Field2

Thanks Jose for your input!

Not applicable

Re: Set Analysis Field1 less than Field2

swuehl.  Thanks.  Your set analysis solution worked.  I couldn't use the example without the set analysis because what you solved for me was a part of a much larger set analsys expression.

much appreciated!