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: 
vipingarg23
Creator
Creator

Aggr in Set analysis

I am trying to exclude some fields using set analysis with aggregation function

I am using below sample expression

Sum(Aggr(sum({$<A={'3'},B={'AP'}>}Total),dim))

I want to apply Aggr function only for B instead of both (A,B). Is it possible?

1 Solution

Accepted Solutions
sunny_talwar

Not sure what you are after, but may be this

Sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))', '$(=$(Var3))'}>}Aggr(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total)*(

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total))-

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Total))),dim))

View solution in original post

14 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't think you fully understand the role of AGGR and the role of Set Analysis.

Can you please describe the analytical problem that you are trying to solve, in non-technical terms?

Cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming to Boston, MA this October!

vipingarg23
Creator
Creator
Author

Please see below thread..

https://community.qlikview.com/thread/214906

I want like this, but I am not getting this expression completely.

sunny_talwar

I want to apply Aggr function only for B instead of both (A,B). Is it possible?

What does this statement means? Can you elaborate?

vipingarg23
Creator
Creator
Author

I just want to know that If we have two expression(separated by comma) in

single set analysis and If I want to apply aggr function only for one

expression, then Is it possible?

On Sun, Sep 3, 2017 at 12:34 AM, Sunny Talwar <qcwebmaster@qlikview.com>

karthikoffi27se
Creator III
Creator III

Hi Vipin,

Please use the below expression


=Sum({$<A={'3'}>}Total)+Sum(Aggr(sum({$<B={'AP'}>}Total),dim))


Many Thanks

Karthik

sunny_talwar

Your response just don't make any sense... can you elaborate with an example?

vipingarg23
Creator
Creator
Author

Hi,

I am refraining my question in different way again:

I am using below expression:

=sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total)*(

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total))-

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Total)))

This expression is working fine. but If I use this expression with AGGR as

below, it is not giving me right data:

Sum(Aggr(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total)*(

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total))-

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Total))),dim))

Can you please confirm if this syntax is fine

.

On Sun, Sep 3, 2017 at 10:58 PM, Sunny Talwar <qcwebmaster@qlikview.com>

Kushal_Chawda

if expression is working fine then why you are using Aggr?

MarcoARaymundo
Creator III
Creator III

Try this

1) Create a variable "vDIM" and put this exprecion:

     if(GetSelectedCount(A) > 0, 'A') &

     if(GetSelectedCount(A) > 0 and GetSelectedCount(B) > 0, ',') &

     if(GetSelectedCount(B) > 0, 'B')

2) Put vDim variable into your expression Sum(Aggr(sum({$<A={'3'},B={'AP'}>}Total), $(vDIM)))