Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to do set analysis in this Aggr Sum expression

Hi Guys,

I am using following Expression in text box to show sum of total paid amount for orders.

=sum(Aggr([Paid Amount], OrderId,[Paid Amount]))

Where Can I add 'if' statement or set analysis in this expression to only see total amount where [Sales Rep] = 'James' ?

Labels (1)
1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

May be this.

=sum(Aggr(If([Sales Rep] = 'James',[Paid Amount]), OrderId,[Paid Amount]))


Or


=sum(Aggr(Sum({<[Sales Rep] = {'James'}>}[Paid Amount]), OrderId,[Paid Amount]))

View solution in original post

6 Replies
stephenedberkg
Creator III
Creator III

try like this

aggr( sum({< [Sales Rep] = {'James'}  >}[Paid Amount])OrderId)

Not applicable
Author

Thanks Stephen, but did not work

NareshGuntur
Partner - Specialist
Partner - Specialist

I don't think you need to use Aggr function for that.


The below should do -


sum({< [Sales Rep] = {'James'}  >}[Paid Amount])

tamilarasu
Champion
Champion

May be this.

=sum(Aggr(If([Sales Rep] = 'James',[Paid Amount]), OrderId,[Paid Amount]))


Or


=sum(Aggr(Sum({<[Sales Rep] = {'James'}>}[Paid Amount]), OrderId,[Paid Amount]))

sunny_talwar
MVP
MVP

Not sure how and where you using this, but may be this (if what Naresh provided doesn't work for you)

=Sum({<[Sales Rep] = {'James'}>}Aggr(Only({<[Sales Rep] = {'James'}>}[Paid Amount]), OrderId,[Paid Amount]))

Not applicable
Author

Thanks for your replies guys..

Almost everyone's expression worked.. but I picked Tamil's for now

Thanks