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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Aggregate using a Variable

Hi

I have defined a variable $(vPlace) that can either be 0 or 1.  I want to try and find the max value of "rating" if $(vPlace) equals 1 but with my current attempt the result returned is null

My expression is: =aggr(max(rating),($(vPlace)='1'))

I'm struggling to find the correct syntax to make this work - any help appreciated.

Thanks

Matt

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

=Max(If($(vPlace)='1',rating))

View solution in original post

3 Replies
JonnyPoole
Former Employee
Former Employee

if( $(vPlace) = 1 , max(rating)  )  -> will calculate the max rating if your variable is 1. 

Is place a field in your data model and you want to calculate the maximum rating when place = 1  ? 

something like this

max (  {$<Place = {'$(vPlace)'}>}  Rating )

anbu1984
Master III
Master III

=Max(If($(vPlace)='1',rating))

Anonymous
Not applicable
Author

Thanks Anbu.  Seems I didn't need to use aggr after all.