12 Replies Latest reply on Feb 17, 2016 10:19 AM by Michael Woodward

# How to create Percent of total?

Trying to create a simple bar chart to show me percent of total for the amount shown on the bottom bar. I need this to show % of total but doesn't seem to be working correctly when I select percent of total when I add a table calculation. Can someone point me in the right direction.

Thanks

• ###### 1. Re: How to create Percent of total?

Are you familiar with Compute Using or Relative To?

If not, not a big deal, this can be confusing when you first start. I recommend building out something very familiar and understandable then see what you need to select on your end.

Example: Table across and Relative to Previous =

Notice 3 nulls = Janurary doesn't have any "previous values" so it will be null

Cheers,

Tyler Garrett

VP of Solutions & Strategy

TableauHelp.com LLC in Austin, TX

1 of 1 people found this helpful
• ###### 2. Re: How to create Percent of total?

Hi Tyler

Thanks for your response. Here is what I get when I use this method. It's shows it as 100%. I checked the underlying data and manually computed it and it should say 38% but I just can't get it to show that way. I've done it before but I just can't recall how to show it.

1 of 1 people found this helpful
• ###### 3. Re: How to create Percent of total?

Looks like you're dividing 37/37 to get 100%. It's hard to work on this without the actual workbook, but in lieu of the response above, you could either try tinkering with the table calculation options until you get the desired result, or do what I like to do: create a calculated field as follows:

1 of 1 people found this helpful
• ###### 4. Re: How to create Percent of total?

You need the denominator to be the sum of all days, right?

Then your calc would be something like this:

[ER less than 5 days WINDOW CALC] / {SUM([days])}

The denominator calc is a LoD to find the total days.  So you'd use whatever measure or count of dimension calc you need in lieu of my [days]

Like what's been said already we need to see a packaged workbook with actual data or something mocked up with what you're doing currently.

1 of 1 people found this helpful
• ###### 5. Re: How to create Percent of total?

I get a calculation error at total.

sum([ER Less than 5 days]) / TOTAL([ER Days])

1 of 1 people found this helpful
• ###### 6. Re: How to create Percent of total?

What is the error?

1 of 1 people found this helpful
• ###### 7. Re: How to create Percent of total?

The error is all field must be aggregate or constant when using table calculation functions.

1 of 1 people found this helpful
• ###### 8. Re: How to create Percent of total?

use this:

sum([ER Less than 5 days]) / {SUM([ER Days])}

1 of 1 people found this helpful
• ###### 9. Re: How to create Percent of total?

You need to aggregate anything in Total()

Don't forget to use the pop up arrow to show this type of explanation.

• ###### 10. Re: How to create Percent of total?

I'm close however the % is just not coming out right. I have 88 ER days and 37 ER days less than 5. This is 42%. But the calculation is coming out as 0.071.

• ###### 11. Re: How to create Percent of total?

What happens if you use this:

SUM([ER Less than 5 days]) / {COUNT([ER Days])}

1 of 1 people found this helpful
• ###### 12. Re: How to create Percent of total?

Bingo that was it. Thanks guys so much. This really helped.