Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Condition using MAX() in IF... else

I surprised to find out that Max() cant be used in conditional statement of IF. I was trying to use ::

if(max(marks)=marks, Rollnumber)

type of statement. but its showing "error in expression".

Even set analysis isnt helping to get solution :

sum({$<marks={$(max(marks))}>} Rollnumber)

Is it something wrong with my approach or QV doesnt allow function in Conditions??

4 Replies
swuehl
MVP
MVP

Hi,

where do you want to use this expression (in what kind of object, as calculated dimension or expression, if as expression, what are your dimensions)?

Anyway, I think the set expression should look like

=sum({<marks= {"$(=max(marks))"}>} Rollnumber)

Regards,

Stefan

Not applicable
Author

Was trying to use it as an expression...

swuehl
MVP
MVP

This is not much of information, is it? If you tell us a little more, the probability that someone around could help you will increase.

If I use a similar expression like the first in your original post, I don't get an "error in expression". marks and Rollnumber are field names and correctly spelled? You don't use the above expression as part / within another expression, like within an aggregation function?

RodolfoNeumann
Contributor
Contributor

I tried to use:

[Prazo]:
LOAD id_campo,
IF(condition, MAX(campo1), MAX(campo2)) as campo3
RESIDENT tab1
GROUP BY id_campo;

and it didn't work. What's wrong?