11 Replies Latest reply on Feb 10, 2017 2:24 PM by Peter Galimutti

# Category Sales Growth - Calculation in Tableau

Hello,

I am having difficulty figuring out the calculation needed to find "% contributed towards category growth".

Below is a snapshot of what I am trying to find: The last column in red are the figures that I cannot recreate in Tableau.

Categories2016 Sales2017 salesDifference in sales% Contributed to Growth
Cat 1

10

15

5

18%
Cat 21018829%
Cat 310201036%
Cat 41015518%
Grand Total406828100%

I am having difficulty getting to the sales difference by category as a percent of the sales difference of the total category.

I think this may require an LOD expression but I am uncertain.

Thanks much,

Dan

• ###### 1. Re: Category Sales Growth - Calculation in Tableau

It should just be a matter of duplicating the sum([Difference in sales]) measure and turning that into a quick table calc - percent of total.

• ###### 2. Re: Category Sales Growth - Calculation in Tableau

I do not have a YoY difference in sales by category which is what is making

this difficult.

On Fri, Feb 10, 2017 at 1:07 PM, John Sobczak <tableaucommunity@tableau.com>

• ###### 3. Re: Category Sales Growth - Calculation in Tableau

Can you upload sample of your data. As per your table ther eis YoY difference or did I miss anything. Regardless a sample data will be very helpful.

• ###### 4. Re: Category Sales Growth - Calculation in Tableau

I agree with Pete and out of courtesy to those of us spending our time to help.  We can chase this all day until the full problem is laid out.   I'm now suspect that you even have the 2016 vs 2017 sales amounts calculated as per your last response of not even being able to figure out the YOY difference.

• ###### 5. Re: Category Sales Growth - Calculation in Tableau

Dan,

You can do that with Table calculation as well.

[Delta]

[Sales 2017 ]-[Sales 2016]

Thanks,

Shin

1 of 1 people found this helpful
• ###### 6. Re: Category Sales Growth - Calculation in Tableau

Thank you for all of the replies so far.

I do not have a sales difference column in my raw data. The above example is what I created in Excel to get at the "% contributed towards category growth" metric. I was using that table to try and confirm some of my efforts in Tableau.

I am able to get the sales difference by category in Tableau by using the Table calc "ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1)" but I cannot get much further. For now, this is only giving me a partial answer but I cannot calculate the "% contributed towards category growth" which is the sales difference in category sales divided by the FIXED sales difference in overall category sales.

• ###### 7. Re: Category Sales Growth - Calculation in Tableau

Maybe try this

ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1)/ {exclude category: sum(sales)}

{exclude category: sum(sales)} - this LOD will exclude category and give you over all sales

2 of 2 people found this helpful
• ###### 8. Re: Category Sales Growth - Calculation in Tableau

Hi Peter,

It is saying I can't mix aggregate and non-aggregate arguments on the "/"

sign.

On Fri, Feb 10, 2017 at 3:54 PM, Peter Galimutti <

• ###### 9. Re: Category Sales Growth - Calculation in Tableau

Here you go, I have taken your data, normalized it (guessing it might be similar to how you have) and created a public dashboard

I have used similar to what Shinichiro Murakami

2 of 2 people found this helpful
• ###### 10. Re: Category Sales Growth - Calculation in Tableau

I appreciate you looking into this further for me.

Best,

Dan