4 Replies Latest reply on Oct 29, 2018 5:18 AM by Akram Ebrahim

# Percentage of Sum of Category

I am brand new to Tableau, watched several videos and am trying to get a grasp on all this tool has to offer. I am working on a problem and have not been able to find an answer in this forum. I have a data set of Names of Salespeople, their Customer's ID numbers, and the \$ amount they sold during the month to that particular customer. What I am looking for is what percent of the salesperson's customers did they sell to. I can create a calculated field generate the total number of customers per salesman and totl number of customers sold to per salesman. I've done COUNTD (customer number) to get the Number of Customers per salesman and FLOAT(IF [Total Sold] > 0 Then '1' ELSE '0' END) to get Number of Customers SOLD TO per salesman. I want to get the percent of those two numbers per salesman. So Alice has 44 customers and sold to 7 of them, it should generate 15.9%. How do I create this percentage? I keep getting the percent of TOTAL customers. I am attaching data for help. Thanks in advance.

• ###### 1. Re: Percentage of Sum of Category

Hi Colleen

I have completed the challenge you are facing in terms of percentage

Hope this helps!

• ###### 2. Re: Percentage of Sum of Category

Can you let me know how you did that so I can replicate it? The data I sent was sample data and not my actual data, so I'd like to be able to recreate that. Also, I anticipate needing to recreate that same information as this isn't a one time report I'm working on.

• ###### 3. Re: Percentage of Sum of Category

Here the steps:

Total Sold Zero Removal:(Name:Total Sold Calculation)

if [Total Sold]<>0 then 'True' else 'False' end

This calculated field is to ignore the 0 records available on total sold column. This will act like a filter. If you set 'TRUE' only non zero records will be taken

Count of Sold:    count(Total Sold)

Ex: For Alice its 7

Count of customer per each Salesperson: (Name : Customers)

{FIXED [Salesperson]:COUNT([Customer Number])}

This LOD expression used to obtain the count customers in each salesperson. Fixed will retain value constantly in all the time

Ex: For Alice its 44

Percentage:

count(Total Sold)/sum(Customers)

2 of 2 people found this helpful
• ###### 4. Re: Percentage of Sum of Category

Hi Colleen,

Hope your issue was solved. Yes then close this question as answered. If not let me know what issue you are going through!