Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
baliyan_vinay
Contributor III
Contributor III

Aggregation inside SET Expression for Comparision

Hi Community,

 

I am having problem with the below expression

=Count(Distinct {<A_STAT = {"> 6050 <=6950"}, A_STAT_IND-={'C'}, A_STAT_FLG={'N'}, A_DET_STATUS=, Aggr(Max(A_CHK_NO),Link_Key)={" < 6964 "} >} Link_Key)

The Aggr part is not working for me, invalid modifier it says. What I am trying to do here is to see if maximum of A_CHK_NO is less than 6964 for my condition. 

 

Thank you for your help.

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Modifier in set analysis is expected to be field and not a condition nor a value. You could try like:

=Count(Distinct {<A_STAT = {"> 6050 <=6950"}, A_STAT_IND-={'C'}, A_STAT_FLG={'N'}, A_DET_STATUS=, Link_Key ={"=Max(A_CHK_NO) < 6964 "} >} Link_Key)

View solution in original post

4 Replies
tresesco
MVP
MVP

Modifier in set analysis is expected to be field and not a condition nor a value. You could try like:

=Count(Distinct {<A_STAT = {"> 6050 <=6950"}, A_STAT_IND-={'C'}, A_STAT_FLG={'N'}, A_DET_STATUS=, Link_Key ={"=Max(A_CHK_NO) < 6964 "} >} Link_Key)

baliyan_vinay
Contributor III
Contributor III
Author

Thanks for the answer. 

The error is gone but the does not satisfy the condition. 

The data looks like this

Link_KeyA_CHK_NO
16500
16700
16750

 

So the Aggr(Max(A_CHK_NO)) was meant to provide 6750 and then comparison against 6964 should satisfy the condition. 

Normal expression works okay for me, see below. But because I need to exclude a filter selection(A_DET_STATUS) for the expression, I am trying the SET expression

=Count(Distinct If(A_STAT>6050 and A_STAT<=6950 and Aggr(Max(A_CHK_NO),Link_Key)<6964 and A_STAT_IND <> 'C' and A_STAT_FLG='N',Link_Key))

tresesco
MVP
MVP

Where are you using this expression, in a chart or text box? Could you share your sample app explaining expected output in that context? 

Brett_Bleess
Former Employee
Former Employee

The following Design Blog post may be helpful on this one too:

https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822

Please be sure to close out the thread if you solved things, you can post what you did if you figured it out on your own, and then use the Accept as Solution button on that post to close the thread.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.