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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

aggr function in pivot table

My data have three columns:

Salesrep, Customer, Sales

RepA, CustomerA, 2

RepA, CustomerB, 4

RepB...

...

 

I would like to create a report by dimension: Salesrep & Customer. In one of the measures, I need to show avg sales by rep on the customer level as well, such as:

Salesrep, Customer, AvgSalesByRep

RepA, CustomerA, 3

RepA, CustomerB, 3

RepB...

...

 

What aggr function should I write here to implement this?

 

Thank you in advance!

1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

Not sure I follow then;

20210701_1.png

Cheers,

Chris.

View solution in original post

6 Replies
chrismarlow
Specialist II
Specialist II

Hi,

Try;

avg(TOTAL Sales)

Cheers,

Chris.

wanyunyang
Creator III
Creator III
Author

Hi there,

Sorry, I should have clarified this in the question. Rep A is not the only sales rep, so avg(Total Sales) wouldn't work.

chrismarlow
Specialist II
Specialist II

Hi,

Ahh, try;

avg(TOTAL <Salesrep> Sales)

Cheers,

Chris.

wanyunyang
Creator III
Creator III
Author

No luck 😞 Each rep ends up with the same number

chrismarlow
Specialist II
Specialist II

Hi,

Not sure I follow then;

20210701_1.png

Cheers,

Chris.

wanyunyang
Creator III
Creator III
Author

Yes you're right! I tried again and it worked. Thank you!