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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
t_hylander
Creator
Creator

Nested MAX-funktion in expressions

I have a set of guages that I want to show only the latest value in the database (in this case a xls-file).

In the file there is: Date, Name, Value

This is what Im trying to do, but its not working...obviously.

Sum ({$<Name={'EM-3210'}, Date={Max(Date)} >}Result)

Just keep getting that MAX is a " Bad field name".

Is there a different solution I can use if this wont work?

1 Solution

Accepted Solutions
Not applicable

Hi,

try this:


Sum ({$<Name={'EM-3210'}, Date={ '$(=date(Max(Date)))' } >}Result)


hints: date() is to format the output of max(), $(= ) is to compare with functions (where a fieldname is expected), '' is needed for crorrect comparing

Regards Roland

View solution in original post

4 Replies
spsrk_84
Creator III
Creator III

Hi,

Instead of passing Max date to date use a variable such that the variable should contain the max value and pass the variable value to Date..

Hope it works fine..

Regards,

Ajay

Not applicable

Hi,

try this:


Sum ({$<Name={'EM-3210'}, Date={ '$(=date(Max(Date)))' } >}Result)


hints: date() is to format the output of max(), $(= ) is to compare with functions (where a fieldname is expected), '' is needed for crorrect comparing

Regards Roland

t_hylander
Creator
Creator
Author

Worked like a charm!

But I guess I should use a variable instead...

Thanks!

Not applicable

You are welcome.

If you like you can use variables. I am using them. But first i try to have a correct expression, then optimizing. For me this saves testing time.