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: 
salto
Specialist II
Specialist II

Compare the values of two numeric variables

Hello,

another (basic?) question:

I have Expr1 and Expr2 as two variables. I want to compare them:

=if(($(Expr1))>($(Expr2)),$(Expr1),$(Expr2))


But QV will no return anything.

The same happens if I use rangemax for this.

Is there any way to compare variables?


Regards.

12 Replies
salto
Specialist II
Specialist II
Author

Hello Nizam, Fabrice,

thank you for your help, the issue is solved already.

Cheers!

Not applicable

Excellent

What was the answer ?

Fabrice

salto
Specialist II
Specialist II
Author

Hi Fabrice,

it is explained (not very deeply anyway) in my third post in this thread: the expressions I was using for the variables were not EXACTLY the ones I had posted: they had more conditions and were formatted as currency.

Just to make my question easier to read, I simplified the expressions as below, removing non mandatory conditions and the currency formatting. I did the same in my QV document, just to give a try... and that did the job.

It works with the expressions written like this:

Expr1:num(sum({<"Date"={"<=$(=date(DateID,'DD/MM/YYYY'))"}>} "Amount"))

Expr2:num(sum({<"Date"={"<=$(=date(DateID-30,'DD/MM/YYYY'))"}>} "Amount"))

And I was comparing them in  text box. The values for Expr1 and Expr2 were correctly shown in other two text boxes.

But I was not using exactly the syntax above for the variables and it seems to be the reason for them not to be correctly compared.

Now they are correctly evaluated and compared with rangemax or  with if(($(Expr1))>($(Expr2)),$(Expr1),$(Expr2))

Best regards!