11 Replies Latest reply on Sep 18, 2018 4:51 AM by Chirag Gandhi

# View a certain percentage of data in a bar graph

Hi everyone,

I have a bar graph in Tableau that displays the number of people within a department for the business they are in. For example, if they are in electronics, there will be different bars for people in repairs, sales, and so on. I want to make it so that the bar only displays departments within the business that are greater than 10% of the business. So if the total number of employees within electronics is 7000, and repairs has 750 employees and sales has 300 employees, the bar will only show repairs and aggregate the lower departments into a new column within the bar graph. I'm new to Tableau and am not sure how to do this. Any suggestions would be much appreciated.

Thank you!

• ###### 1. Re: View a certain percentage of data in a bar graph

Hi Chirag,

Could you please attach a sample data and along with the O/P required.

BR,

NB

• ###### 2. Re: View a certain percentage of data in a bar graph

Chirag,

Create a calculated field as COUNT(Employees)/SUM({Fixed: COUNT(Employees)}). Numerator gives the employee count for sub-departments and denominator gives the total employees of the company.

Then put this field into the filters pane and select at least 0.1 value, for sheet to filter appropriately.

• ###### 3. Re: View a certain percentage of data in a bar graph

So I want to only display the departments within electronics bar that have more than 50% of the total number of employees within the business (electronics). So there are 12 records. Any department within the business that has more than half (6 or greater) the total of the entire business should be displayed, and the other departments should be aggregated to a new column called other.

• ###### 4. Re: View a certain percentage of data in a bar graph

Chirag,

Can you check if this helps you?

• ###### 5. Re: View a certain percentage of data in a bar graph

Thanks for your help! Unfortunately not. I already have a table that displays the number of records for each department within a business. I need the bar graph to only display sales department for electronics (because there are more than 50% of employees working in that department (9) that make up the entire electronics business (12)), and move services to another bar called other.

• ###### 6. Re: View a certain percentage of data in a bar graph

Now I understand what you're trying to do. Can you post a sample worknnok where count of employees is something different from the Tableau default no.of records?

As their will be different numbers for departments for business, I'd get multiple rows of for employee count (if I make the measure discrete) and then I can write the condition. Now as it is No.of Records, the data gets aggregated no matter what.

So, Can you post a sample workbook where Employee count can be something else that is coming from the datasource instead of Default No.of Records?

• ###### 7. Re: View a certain percentage of data in a bar graph

Hi Maneesh,

I have uploaded another workbook. Not sure if this is what you require.

• ###### 8. Re: View a certain percentage of data in a bar graph

Chirag,

I think I got it. Take a look at workbook and let me know if you have any questions.

1 of 1 people found this helpful
• ###### 9. Re: View a certain percentage of data in a bar graph

Thanks, this is what I needed! Do you mind explaining what you did. I see new dimensions and measures but because I am new, it would really be helpful if you could explain. Thanks again!!

• ###### 10. Re: View a certain percentage of data in a bar graph

I created three calculated fields and made it all dimensions.

1) Employee per Business and Department: This counts the employees at Business and Department level. I changed it as dimension because it adds a row for each department. If I left it as Measure, it aggregates at business and doesn't show the numbers by department.

2) This is also doing the same but calculating the employee count at Business level rather than both department and business levels.

3) I created a derived field that satisfies your condition that says if 1/2 is greater than or equal to 0.5 (50%) then let it stay as the [Department name] else call it as 'Other'.

Hope this makes sense. Let me know if you have any questions.

1 of 1 people found this helpful
• ###### 11. Re: View a certain percentage of data in a bar graph

Thank you!