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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

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))

View solution in original post

4 Replies
chematos
Specialist II
Specialist II

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

swuehl
MVP
MVP

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
Author

Thanks Jose for your input!

Not applicable
Author

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!