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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Missing a dimension association in Aggr()

Hi. I'm new to QlikView and an attempting to translate some tedious Excel operations to QlikView... For example I have the following dataset:

Sales CodeTeamSales PersonSales Amount
A1T1John$100
A1T1Mary$100
A2T1John$300
A2T1Mary$300
A2T2Paul$300

Each unique Sales Code is sales, and the Sales Amount is the total amount of the entire sales. So say for A1, both John and Mary did the job for the total amount of $100. Assuming the team split is even for each sales: so for Sales Code A1, Team T1 will be $100, and for sales A2, T1=$150 and T2=$150. Now I'd like to look at the total sum of Team Share by Team, I put in this expression in a straight table chart (with Team as the dimension):

Sum([Sales Amount]/(Aggr(Count(Distinct (Team)), [Sales Amount])))

But the resulting table becomes this only:

TeamTotal Share
T1$250

This figure for T1 is correct ($100 + $150), but T2 just won't show up. Am I making a mistake in Aggr()? Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Sum(Aggr(Avg(TOTAL <[Sales Code]> [Sales Amount])/Count(DISTINCT TOTAL <[Sales Code]> Team), [Sales Code], Team))

Capture.PNG

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

try this

Sum([Sales Amount]/(Aggr(Count(Distinct (Team)), [Sales Amount],Team)))

otherwise aggr function disregards the table dimension

sunny_talwar

Try this:

=Sum(Aggr(Avg(TOTAL <[Sales Code]> [Sales Amount])/Count(DISTINCT TOTAL <[Sales Code]> Team), [Sales Code], Team))

Capture.PNG

Not applicable
Author

Thanks. That seems a mouthful.. May I know why the Avg() is needed in this case (assuming the TOTAL / Count should already split the total)?

Thanks again!