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: 
Not applicable

Min/Max aggregated function

Hi all,

I'm trying to find max, min values for netted amounts throughout the day.

For every hour I'm calculating the net value for incoming and outgoing payments, leaving a negative or positive value.

Now I wish to rank these netted flows, for instance the largest positive and negative hourly flow for the selected date.

I tried the below, the syntax seems to be OK, but I'm only getting null values in return.

any ideas?

MAX  (AGGR  (SUM  (  {<Receiver = {'US'}>} [Amount] )- sum(  {<Receiver -= {'US'}>} [Amount]  ), Time  )  )

Thanks in advance,

Olle

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Are you using this in a chart/table with the date as a dimension? If so, you need to include this dimension in your Aggr() function. Like this (assuming the date is a field called [Date]):

Max(Aggr(Sum({<Receiver = {'US'}>} [Amount]) - Sum({<Receiver -= {'US'}>} [Amount]), [Time], [Date]))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

7 Replies
PrashantSangle


Hi,

Try something like this,

MAX  (AGGR  (SUM  ({<Receiver = {'US'}>} [Amount]),Time)) - Max(AGGR  (sum(  {<Receiver -= {'US'}>} [Amount]),Time))

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
MK_QSL
MVP
MVP

Max(Aggr(Max({<Receiver = {US'}>}Amount)-Max({<Receiver -= {US'}>}Amount),Time))

Not applicable
Author

Hi Max,

tried it and it's giving me the very same results as the below "core" calculation.

sum( {<Receiver = {'US'}>} [Amount] )- sum( {<Receiver -= {'US'}>} [Amount] ))

@MAnish,

receiving null values with your code.

//O

PrashantSangle

Hi,

Can you post sample application.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Pls see attached Sample File, I've replaced counterpart names to "THEM" so no need for the -=US.

//O

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Are you using this in a chart/table with the date as a dimension? If so, you need to include this dimension in your Aggr() function. Like this (assuming the date is a field called [Date]):

Max(Aggr(Sum({<Receiver = {'US'}>} [Amount]) - Sum({<Receiver -= {'US'}>} [Amount]), [Time], [Date]))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks Jonathan!