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: 
samp
Contributor III
Contributor III

Set Analysis Get MAX and AVG values after aggregate same value on few dimensions level

Hi All, need help on set analysis on below sample data and expected out put.

Load * Inline [
ID, YEAR, GRP1, GRP2, COMP, AMOUNT
1, 2020, app1, xyz, Comp1, 100
1, 2020, app2, xyz, Comp2, 300
1, 2020, app1, xyz, Comp1, 100
1, 2020, app2, xyz, Comp2, 600
2, 2020, app1, xyz, Comp3, 400
2, 2020, app2, ttt, Comp4, 200
3, 2020, app3, xyz, Comp5, 400
3, 2020, app2, xyz, Comp6, 300
3, 2020, app2, xyz, Comp6, 300
4, 2020, app1, xyz, Comp7, 500
4, 2020, app1, xyz, Comp7, 500
4, 2020, app2, ttt, Comp8, 200
4, 2020, app2, xyz, Comp8, 500
4, 2020, app1, ttt, Comp9, 200
]; 

Expected Out Put for just ID selection 1:

GRP1Level Of Total%Max Level Of Total%Min Level Of Total%Avg Level Of Total
app116001000/1600200/1600533/1600
app22000900/2000500/2000666/2000

 

Here "Level Of Total" metric is working fine, but I am unable to get above numerators as in below images to calculate percentages,.

The selection ID = 1 is associated to GRP1 values(app1, app2) and GRP2 value ( xyz), my out put should exclude ID selection.

Measures:

1) Level Of Total: need total AMOUT for  field GRP1(app1,app2) and field GRP2(xyz) by excluding ID selection, below expression is working fine, I am ok with this.

AGGR(Sum({<YEAR={$(=Max(YEAR))},ID=>}AMOUNT),GRP1,GRP2) //ok

2) %Max Level Of Total: Here I need to get max value after sum of AMOUNTS on GRP1, GRP2 and COMP level as in below

image1 (selected app1 and xyz values since both are associated to ID:1 by excluding ID filter) same with Image2.

 

AGGR(MAX(AGGR(Sum({<YEAR={$(=Max(YEAR))},ID=>}AMOUNT),GRP1,GRP2,COMP)),GRP1,GRP2) //Not ok

 

imag1.PNG

 

imag2.PNG

 

3) and 4) Once max expression works fine then I can do for min and avg expressions.

Appreciate for your help, thanks in advance.

Expected Out Put for just ID selection 1:

GRP1Level Of Total%Max Level Of Total%Min Level Of Total%Avg Level Of Total
app116001000/1600200/1600533/1600
app22000900/2000500/2000666/2000

 

 

 

Labels (2)
1 Solution

Accepted Solutions
JGMDataAnalysis
Creator III
Creator III

You have to add the same set modifiers in the outer aggregation function...

QlikCommunity_20200404.PNG

View solution in original post

2 Replies
JGMDataAnalysis
Creator III
Creator III

You have to add the same set modifiers in the outer aggregation function...

QlikCommunity_20200404.PNG

samp
Contributor III
Contributor III
Author

thanks it works