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

Comparing 2 Numeric Fields in an Expression

Hi,

we have one table in data model with columns M2 and M5 (both numeric).

We have a formula (with set analysis conditions) that filters the data set in the table. Formula goes something like this:

=sum({$<M2={">0"}, M2={">0"}>} flagOO)

We have veryfied that we get the correct subset from the table.

In the following step we would like to make a following comparison:

M5={">=M2"}>

and sum the resulting rows (flagOO can only have numerical value of 1)

Our approach is (and it is not functioning as we expect):

=sum({$<M2={">0"}, M2={">0"}, M5={">=M2"}>} flagOO)

Can you please give us a suggestion on how we should adapt the formula? Thx!

D.

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

The M5>=M2 is a comparison that must be made on the row level (not globally), so you cannot use Set Analysis for that. Instead, do a

=sum({$<M2={">0"}, M5={">0"}>} If( M5>=M2, flagOfferOrder))


HIC

View solution in original post

2 Replies
hic
Former Employee
Former Employee

The M5>=M2 is a comparison that must be made on the row level (not globally), so you cannot use Set Analysis for that. Instead, do a

=sum({$<M2={">0"}, M5={">0"}>} If( M5>=M2, flagOfferOrder))


HIC

Not applicable
Author

Thnks Henric!
This is the correct answer!

Best regards,

D.