4 Replies Latest reply on Feb 12, 2017 7:02 AM by Norbert Maijoor

Percent of row total for a measure (noob question)

Tableau community,

I have a question that will likely be quick for many of you.  I want to get a percent of total calculation by individual row.  I put a simple example dash on Tableau Public at:

https://public.tableau.com/profile/publish/Percenttotalcalchelp/Sheet1#!/publish-confirm

In the example, I'd like Home to show 30% at the end of the bar and Office with 60%.  There are tons of examples showing percent totals for the whole set of products...but I can't seem to find one by row.  One of my issues seems to be that it is doing the percentage of just the grouping that is purchased as Yes or No.  In other words...I get a percentage of 100% of total for No and 100% for Yes (but I want it to combine the two for the total number of records).  I tried a LOD calc with INCLUDE and it did the same thing.  That said...I could've done it incorrectly.

Help greatly appreciated!

Thank you

Scott

• 1. Re: Percent of row total for a measure (noob question)

Hi Scott,

Find my approach as reference below and stored in attached workbook version

• 2. Re: Percent of row total for a measure (noob question)

I can't get the file to open...I have v10.  The screenshot isn't quite what I'm trying to do (but is very similar).  I want that percentage value to show up next to each one as a mark label.  But I do want to still show both (yes and no) and not just the yes ones.  If you know how to do this...could you either do screenshots of the formulas and pages...or post to tableau public to make sure I can access it?

Thank you!

• 3. Re: Percent of row total for a measure (noob question)

Hi Scott -

Use this calculation on the label. Make sure the table calc is set to  compute using 'Purchased'

if attr([Purchased]) = 'Yes' then SUM([Number of Records]) / TOTAL(SUM([Number of Records])) END

This will only label the 'Yes' bar segment.

• 4. Re: Percent of row total for a measure (noob question)

Hi Scott,

Find my updated approach below and stored at Tableau Public