Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cfountain72
Creator II
Creator II

Max of Values across Dates

Hello,

I am trying to generate avg of maximum Ages and avg of minimum Ages by Dates. So in the example below, the bottom row of Avg (17.4 and 87) would be the values I want to return.

Date       Count Min      Max

7-Aug253085
6-Aug28798
5-Aug332278
4-Aug25690
3-Aug213075
2-Aug30494
1-Aug232389
Avg 17.487

 

I could create a summary by date table in the load script (as above), but that would remove the flexibility of filtering at more granular levels. I tried using aggr and the expression below, but I get no results. Is it a syntax issue, or something more fundamental?

avg(distinct Aggr(Max({<FirstIPOPEncAdmissionTime = {"$(='>=' & timestamp(now(0)-100))"}>} AgeYears), date(FirstIPOPEncAdmissionTime, 'MM-DD-YYYY')))

Thanks in advance for your help!

Chris

1 Reply
jbhappysocks
Creator II
Creator II

Hi. Try removing the date() around FirstIPOPEncAdmissionTime. And I also don't think you want to use distinct.

So try

avg(Aggr(Max({<FirstIPOPEncAdmissionTime = {"$(='>=' & timestamp(now(0)-100))"}>} AgeYears), FirstIPOPEncAdmissionTime))

 

(You probably need to add a new field floor(FirstIPOPEncAdmissionTime) as FirstIPOPEncAdmissionDate in the script and use instead of Time)