
1. Re: How to use 2 table calculations in 1 measure
Adam Crahen Feb 22, 2016 6:10 PM (in response to Randy Adhitama Setiadi)Hey Randy
If you create the % of total as an LOD you can then aggregate it again for the difference
Percent of Total
{fixed [Range Value], [Brand] : sum([Value])}/{fixed [Brand] : sum([Value])}
Then I did a table calc on the SUM([Percent of Total]) Difference along Brand
9.0 workbook attached.

Table Calculations.twbx 31.5 KB


2. Re: How to use 2 table calculations in 1 measure
Bora Beran Feb 22, 2016 11:21 PM (in response to Randy Adhitama Setiadi)1 of 1 people found this helpfulYou can use two table calculations in one field. You can use a lot more than that actually. These are nested table calculations. You first build separate calculations and each of these could have separate formula even separate addressing/partitioning/sort etc. settings and then you refer to them from another calculation.
The easiest way to do this first drag SUM(Sales) table calc to the data pane. This will save it as a calculated field. Let's say you call it Calculation1. Then you can write difference from calculation using a reference to Calculation1. As you see in the screenshot below, you will also get a drop down in table calculations dialog for each level of nested table calculation you have. Since Calculation2 (the difference from calculation shown at the bottom of this dialog) refers to Calculation1, it is shown in the drop down. Tableau will first calculate Calculation1 with the settings you use in this dialog and then take its results and use as input to Calculation2.

3. Re: How to use 2 table calculations in 1 measure
Randy Adhitama Setiadi Feb 29, 2016 11:51 PM (in response to Randy Adhitama Setiadi)Hi Adam,
Sorry to reply too long, because I still think why the calculations with table calculation and the one that your way it's different in my original workbook. But now I know the problem.
This still the same between the one with table calculation with percent of Total with our created calculated field
But now it's become different. The reason is I put "Last Date Show" field. I need this variable to calculated only the last data from the same ID that "have a value" not only null value. I attached the new workbook with new data source. How can we deal with these?
Hi Bora,
Thanks to your reply, I still figure out your way. Hope you can also help me with these new problem :d
Thanks
Randy

Table Calculations_v2.twbx 13.7 KB
