Using max with ifelse statement

while I am writing the query like below, I got an error,please help me in that

Query---->
max(ifelse{target}=“AA” OR {target}=“EE”,{annual},ifelse({target}=“DD” OR {target}=“VV”,{annual_pre},“NULL”)))

Hi @Rajeshkommi - Welcome to AWS Quick Sight community and thanks for posting the question. Can you please try the below command.

ifelse(({target}="AA" OR {target}="EE"),{annual},({target}="DD" OR {target}="VV"),{annual_pre},"NULL")

Thanks Sanjeeb for your reply but I am applying max function over that ifelse I am getting error.

Hi @Rajeshkommi - Can you please share the error screenshot? it will help us. I missed the max in my logic

max(ifelse(({target}="AA" OR {target}="EE"),{annual},({target}="DD" OR {target}="VV"),{annual_pre},0))
1 Like

This is the error I am facing

Hi @Rajeshkommi - I tested with sample data and get the below result.

Input data:

max(ifelse(({target}="AA" OR {target}="EE"),{annual},({target}="DD" OR {target}="VV"),{annual_pre},0))

In the visual see the maxt value

are you looking for this, or give more information about your requirement.

Regards - Sanjeeb

Thanks Sanjeeb
That’s working fine.