Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Peve
Contributor
Contributor

Sum grouped by

Hi all,

I have the following problem: in a table I need to calculate the ammount sold by each consultant in a specific team divided by the total ammount sold by that person (independently from where he/she has sold).  

Region

Team Consultant Units sold Calculation required
Region 1 Team 1 Marco 3

=3/(3+6) = 33.3%

Region 1 Team 2 Marco 6 =6/(3+6) = 66.6%
Region 2 Team 3 Gianni  4 =4/(4+0) = 100% 
Region 3 Team 4 Gianni 0 = 0/(4+0) = 0%
Region 1 Team 2 Franco 2 = 2/2 = 100%

 

I have already tried the following formula: sum(aggr(count(products),Consultant)), but I then get this as a result:

Region

Team Consultant Units sold Calculation required
Region 1 Team 1 Marco 3

=3/(3+6) = 33.3%

Region 1 Team 2 Marco 6 =0%
Region 2 Team 3 Gianni  4 =4/(4+0) = 100% 
Region 3 Team 4 Gianni 0 = 0%
Region 1 Team 2 Franco 2 = 2/2 = 100%

 

which is unfortunately wrong. 

Any help will be highly appreciated. 

PS: I can only operate in a Set Analysis or with variables. The loadscript for this app is way to complicated for my basic understanding. 

Labels (2)
5 Replies
vinieme12
Champion III
Champion III

As below, corrected

Sum(Unitssold)/Sum(TOTAL <Region,Consultant> Unitssold)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Andrea_Spinetti
Former Employee
Former Employee

Hi @Peve, you may try this: Sum([Units sold]) / Sum(TOTAL <Region,Consultant> [Units sold])

If the issue is solved please mark the answer with Accept as Solution.
Andrea_Spinetti
Former Employee
Former Employee

Ops, I've just seen @vinieme12 already provided the solution 😆

If the issue is solved please mark the answer with Accept as Solution.
Peve
Contributor
Contributor
Author

Hi,

 

thank you for your reply, I did try that one, but however, for some reasons it was aggregating only on the Region and not on the Consultant. 

Peve
Contributor
Contributor
Author

Hi,

 

thank you for your reply, however I have already tried that one. Unfortunately it was aggregating only on the Region and not on the Consultant. Has to be said, that in the "count" I have quite a list of expressions.