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

Probably a Set Anlysis solution

Let's assume I have 3 sales rep selling shoes, socks and trousers.

Sales rep 1 has sold

10 shoes

10 socks

Sales rep 2 has sold

10 shoes

10 trousers

Sales rep 3 has sold

20 shoes

20 trousers

My data is something like :

Sales RepShoes soldSocks soldTrousers Sold
11010
21010
32020

And I want to represent this in a basic stacked bar chart representing the average number of each item sold by my sales reps

With this:

Dimension : Item Sold

Expression : sum(nbr items sold)/count(distinct sales rep)

I will get for the trousers part : 15 trousers (sold on average by the sales rep). This 15 represents the average number of trousers sold by my sales rep who actually sell trousers.

Now, some of my clients would like a different number : the number of trousers sold on average by my sales rep including those who don't actully sell trousers (in this case it would be 10 + 20 / 3 (sales rep) i.e. 10 (instead of 15).

How do I manage to do that in my bar chart? (it means dividing sum(nbr items sold) by the total number of sales rep including those who have sold an amount of 0)

Thanks in advance

2 Replies
sunny_talwar

Your dimension name and expression don't seem to match with the data you have provided. Are you sure your data looks like the way it is displayed above?

swuehl
MVP
MVP

Maybe just like

Sum(Qty) / Count(DISTINCT TOTAL [Sales Rep])

(having used a crosstable LOAD to get your data into a straight table format)

SalesRep.png

edit:

Or create a variable vSalesRepTotal

=Count(DISTINCT [Sales Rep])

and then

=Sum(Qty) / vSalesRepTotal