Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregation Query

Hi,

I am trying to Aggregate a sample set of data. It looks something like;

    

MarksSemesterStudentSubject
801BEco
801BEnglish
801AEco
801AEnglish
801AMaths
1001AMain_Eco
1001AMain_English
1001AMain_Maths

The Requirement is to aggregate the set by Student such that any student ,if has at least one subject starting with'Main' , then the result should be Yes, else No, .Hence Student 'A' should be "Yes' and B be 'No'

I tried with the below expression, but the problem is it gives 'No' for Student 'A' with Non-Main subject row,

     if((Left(Subject,4)='Main')  ,If(Aggr(Sum(Marks), Student)>0,'Yes'),'No')

The result should look something like :

 

StudentSubjectSemesterAggr
BEco1No
BEnglish1No
AEco1Yes
AEnglish1Yes
AMain_Maths1Yes
AMaths1Yes

Appreciate any help !

Thanks

1 Solution

Accepted Solutions
MarcoWedel

Hi,

another solution could be:

=If(Max(TOTAL<Student> WildMatch(Subject,'Main*')),'Yes','No')

QlikCommunity_Thread_170286_Pic1.JPG

hope this helps

regards

Marco

View solution in original post

6 Replies
sunny_talwar

Try this:

If(WildMatch(Aggr(NODISTINCT Concat(DISTINCT Subject), Student), '*Main*'), 'Yes', 'No')

Output:

Capture.PNG

sunny_talwar

Not sure if you need the second condition for any reason, you can add that in there too:

If(WildMatch(Aggr(NODISTINCT Concat(DISTINCT Subject), Student), '*Main*') and Aggr(NODISTINCT Sum(Marks), Student) > 0, 'Yes', 'No')

maxgro
MVP
MVP

if(max(TOTAL <Student> aggr(count({$ <Subject={"Main*"}>} Subject), Student, Subject, Semester))>0, 'yes', 'no')

MarcoWedel

Hi,

another solution could be:

=If(Max(TOTAL<Student> WildMatch(Subject,'Main*')),'Yes','No')

QlikCommunity_Thread_170286_Pic1.JPG

hope this helps

regards

Marco

MarcoWedel

or

=If(Min(TOTAL<Student> Subject like 'Main*'),'Yes','No')

hope this helps

regards

Marco

Not applicable
Author

Thanks Marco !