Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average sales per product across all customers

Hi,

I'm looking for a way to calculate and chart the average sales of different products across all customers. By default Qlik Sense seems to calculate the average sales per customer who purchased that item.

What I get: Total sales of apples / Customers who purchased apples

What I want: Total sales of apples / Total customers


I'm currently using this expression: Sum(SALES)/Count(distinct CUSTOMER_ID)

What would be the correct expression?

Below is some sample data I created to explain the problem. The table shown in the screenshot is the complete dataset. In this example, a single customer have purchased a lime, so the average sales of lime is 1 in the chart. I would like this to be 0,1 (sales divided by all customers).

sample_sales.JPG

1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe with a TOTAL

Count(distinct TOTAL CUSTOMER_ID)

View solution in original post

2 Replies
maxgro
MVP
MVP

maybe with a TOTAL

Count(distinct TOTAL CUSTOMER_ID)

Not applicable
Author

Thank you, that did the trick!

In my actual data, I have a period dimension as well, so I had to add "<PERIOD>" to make it not ignore the period dimension:

Sum(SALES)/Count(distinct TOTAL <PERIOD> CUSTOMER_ID)