Skip to main content

Hi Tableau fellas, hope you are safe and doing well.

 

I want to calculate a price range's sales value's growth compared to previous years total sales. This should give me the contribution of that range's sales growth to total growth, like how much of this years growth came from that range.

 

Formula is like;

 

( Price Range A's 2019 Sales - Price Range A's 2018 Sales) / (Total 2018 Sales)

 

Here you can see the table we are working on;

How to Calculate Contribution to Growth Percentage Compared to Previous Year's Data

 

Here is our failed trial of calculated field;

123.PNG

 

And also maybe we should calculate this field on our source excel data, is that better, or are there better ways to do it inside of Tableau. We don't want to go back to our excel and play with our raw data unless we must do it.

 

Thanks in advance, #stayhome

1 个回答
  1. 2020年4月16日 13:07

    Nisan -

    If I understand you fully, you can re-write your calculation to the following,

     

    (ZN(SUM([Value])) - LOOKUP(ZN(SUM([Value])), -1)) / {SUM(IF YEAR([Date])=2018 THEN [Value] END)}

0/9000