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

"Total" aggr function help

Hi,

Am trying to capture an average price for a particular material across all sites. In the past, have used something similar to:

sum(total<Material>Euros/1000)
/
sum(total<Material>QtyKG/1000)

However, I would like to capture the average price for a particular period (and the period view, is defined by the user ie Annual, Quarter, Monthly). For this, I have used a variable. My formula then looks something similar to this:

sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} Euros)
/
sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} QtyKG)

The above works well, and defines an Average Price for earliest selcted period, but this is only at site/material level. I am trying to expand the above, so that it returns an average price across all sites. So technically, all I have to do is add the "Total" and "<Material>" into the above formula - although I am having some issues...

can anyone point me in the right direction please...

Kind regards,

Rich

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

this is the solution:

sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} Total <Material> Euros)
/
sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} Total <Material> QtyKG)

View solution in original post

1 Reply
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

this is the solution:

sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} Total <Material> Euros)
/
sum({$<'$(zvarTimePeriod)' = {'$(=minstring($(zvarTimePeriod)))'}>} Total <Material> QtyKG)