7 Replies Latest reply on Jan 22, 2016 7:42 AM by Kent Sloan

# Percentage of Total

How do I create the last 2 columns?

NameItems
Week 1Week 2Total% of Total
% of Grand Total
Jane Total4090130=130/130=130/210
JaneBook2050=70/130=70/210
Paper2040=60/130=60/210
Mike Total6050110=110/110=110/210
MikeComputer4030=70/110=70/210
Lamp2020=40/110=40/210
Grand Total90120210=210/210
• ###### 1. Re: Percentage of Total

Hi Margaret,

The real key to making this work is setting the data structure up in a way that Tableau can make the most use of. Below is an example of what I have set up in Tableau to mimic what you are looking for and the data structure I used to underneath. Attached is the workbook where you can go through the table calculations used to calculate the percentages. I hope this helps.

Thanks,

Kent

Data Structure

• ###### 2. Re: Percentage of Total

Kent, thank you. Do you have the attached workbook?

• ###### 3. Re: Percentage of Total

Hi Margaret,

I am not sure I follow the question. Is the attached workbook not displaying for you or do you have a question about the workbook? You should be able to download the workbook by clicking the icon circled below.

Thanks,

Kent

• ###### 4. Re: Percentage of Total

I see. From inbox, I can't see the attached WB. I can see it by going to "Your View". Thanks!

• ###### 5. Re: Percentage of Total

No problem. For a second you made me think I forgot to attach the workbook.

• ###### 6. Re: Percentage of Total

Hi Kent,

For the data structure you have shown, questions:

How do I get the sum (Number of Records) to be the sum (Values)?

How do I get the name and items columns to disappear?

Is one of the purpose of dashboard to combine what you did? Can these calculations be done on the same page?

Also, the week values in my original data source comes in columns, not rows. Is there a way to do the same?

Thank you.

Best Regards,

Margaret

• ###### 7. Re: Percentage of Total

Hi Margaret,

To replace sum of records with the sum of values drag the values field and drop it on top of SUM(Number of Records) in the measure values card.

To hide the name and item headers right click on pill on the columns shelf and uncheck show header.

The dashboard is used to place the two views into one space. You could likely fit these into the same table using the method described in this blog post to create what looks like a table but I think it would become much more work than it would be worth.

https://www.interworks.com/blog/ksloan/2015/01/07/row-level-highlighting-tableau

I would highly recommend restructuring your data to list the weeks in a single column. If you are not able to do this before importing to Tableau you can pivot the data after bringing it into Tableau in the Data Source tab, detailed in the link below.

Pivot Data (from Columns to Rows)

Thanks,

Kent