Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Partner - Creator II
Partner - Creator II

Aggr is not working for desired result ?

Hi All ,

I tried below expression to get desired result . But this does not work . Earlier i had posted similar doubt which for some reason was spammed .

expression - max({1<target,proft>}Aggr(Max(TOTAL <target,proft,date_of_sale> date_of_sale),Client))

Source Data

Client target proft date_of_sale
C1 200 50 22/03/23
C1 100 20 17/03/23
C1 150 60 10/2/2023
C2 50 10 12/3/2023
C2 40 15 2/2/2023
C3 30 5 1/2/2023
C3 70 30 12/12/2022

 

Output 

Client target proft date_of_sale max_date_for_client
C1 100 20 17/03/23 22/03/23
C1 200 50 22/03/23 22/03/23
C1 150 60 10/2/2023 22/03/23
C2 50 10 12/3/2023 12/3/2023
C2 40 15 2/2/2023 12/3/2023
C3 30 5 1/2/2023 1/2/2023
C3 70 30 12/12/2022 1/2/2023

 

Thank you .

Labels (1)
2 Solutions

Accepted Solutions
MayilVahanan

Hi

Try like below

Dim:

Client target proft date_of_sale

 

Exp:
Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft)))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

MayilVahanan

Hi

Try like below

If(Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft)))= max(date_of_sale), Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft))))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

Hi

Try like below

Dim:

Client target proft date_of_sale

 

Exp:
Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft)))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Thank You Sir . It works .

Can you also share me the set expression for below result as well . I tried firstsorted value but that didnot work .

 

Client target_on_max_date proft_on_max_date maxdate
C1 200 50 3/22/2023
C2 50 10 3/12/2023
C3 30 5 2/1/2023
MayilVahanan

Hi

Try like below

If(Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft)))= max(date_of_sale), Date(max(Total<Client>Aggr(Max(date_of_sale),Client, target, proft))))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.