Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jalpashukla
Partner - Contributor III
Partner - Contributor III

Need the average of max date for respective IDs

Hello all, can someone please help me to get the desired result by using chart expression for below table:

IDs Date Value
abc 1-jan-2019 3
abc 3-mar-2019 2
abc 14-apr-2019 5
xyz 20-jan-2019 4
xyz 6-apr-2019 2
xyz 28-feb-2019 5

 

Desired Result:  If I select 'abc', the result should be 5 as 14-apr-2019 is maxdate. The same will happen for 'xyz' as well. But if I don't select anything, the result should be average of (abc-5) and (xyz-2).

Thanks in advance.

@sunny_talwar 

Labels (7)
3 Replies
lironbaram
Partner - Master III
Partner - Master III

Hi 
This expression should work for you :

avg(aggr(FirstSortedValue(Value,-Date),IDs))
jalpashukla
Partner - Contributor III
Partner - Contributor III
Author

Hi,

I tried with this expression but it didn't work for me. 😞  The date is taken as max date in result.

lironbaram
Partner - Master III
Partner - Master III

Hi 
check out the attached app.