7 Replies Latest reply on Jun 3, 2016 11:23 AM by msa s

How to get percentage of total by week?

I have sale counts of flowers and fruits sold each day and can be aggregated over weeks. I'm interested to know how to get percentage of flowers vs fruits sold each week and for each week, the percentages should sum up to 100%. I think the difficult part is how my columns are structured. Rose and mango are subsets of flower and fruit sold respectively but we can ignore it for now.

Here is my data:

my workbook: (i have measure names filtered to include only 'flower' and 'fruit')

currently it is sum but i want percentage by column where y axis should be 100%. i tried Analysis > get percentage by column but i get equal distributed color parts instead.

workbook attached.

• 1. Re: How to get percentage of total by week?

I have done this in the attached.

1 of 1 people found this helpful
• 2. Re: How to get percentage of total by week?

Hi Jenn,

I would suggest you the data reshaping to get this done quickly. Refer to the below screenshot fro reason.

I have calculated total unit sold by weeks which you can see as Wk1-860 and Wk2- 550When I am trying to calculate the % I need to divide flower units by Total which is exactly what I am doing in the Calc_%Flower column. Here is a problem as you can see the values are repeated for all the rows. If I create one more calculation it will add up one more column which will have % for all weeks and items.

-Thanks and Regards,

Ashish Chaudhari

• 3. Re: How to get percentage of total by week?

Here you are Jenn,

All you had to do was Pivot the 2 fields Flower and Fruit.

See example in the workbook attached. It is tableau version 9.2.4

1 of 1 people found this helpful
• 4. Re: How to get percentage of total by week?

Let me know know if you have any more questions on this

• 5. Re: How to get percentage of total by week?

See attached image for how to place fields on the shelves once the columns are pivoted

1 of 1 people found this helpful
• 6. Re: How to get percentage of total by week?

Hi, How did you pivot the field values in the measures field?

• 7. Re: How to get percentage of total by week?

Hi

Please check this , click on data source and select

http://www.datarevelations.com/reshaping-survey-data-with-tableau-9-0.html

1 of 1 people found this helpful