2 Replies Latest reply on Mar 13, 2018 6:13 AM by Rafael Moreira

# Custom calculation with values of specific rows

Hey guys,

I've been looking all through the docs and still haven't found a way to get the values on specific rows in order to make custom cross-row calculations.

Take the table above as an example:

Each row on the table is an aggregation of multiple records based on the account, is there any way to calculate the percentage of Net Revenues (Row 3) based on the Total Revenues (Row 1)?

• ###### 1. Re: Custom calculation with values of specific rows

Pl attach a workbook.

• ###### 2. Re: Custom calculation with values of specific rows

Hello Deepak,

Sorry about my late reply. I have been looking for an answer for this problem on this community and on the entire internet. However without success. I created a simplified workbook to help us to understand the problem. I don't know, but maybe it is not possible to have this kind of think done by Tableau.

On this example, we have these kinds of Data:

1. Region
2. Drink
3. Consumption

So, we will have Region, followed by Drink into the Rows Shelf and the Consumption will be a SUM (drag and drop into the Maks/Label Shelf).

However, for each Region, I need to have 4 new values showing a Calculation, the bold rows at Drink column bellow. Like we have with Analysis/Totals/Subtotals, but considering just Alcoholic and Non-Alcoholic Drinks.

The Calculations:

• Non-Alcoholic Drinks will be the sum of the Consumption for Coke, Juice and Water drinks;
• Alcoholic Drinks will be the sum of the Consumption for Beer and Wine;
• Non-Alcoholic Ratio will be Non-Alcoholic Drinks / (Non-Alcoholic Drinks + Alcoholic Drinks) [The percentage]
• Alcoholic Drinks Ratio will be Alcoholic Drinks / (Non-Alcoholic Drinks + Alcoholic Drinks) [The percentage]

This is an exemple of how I expect to see these Data into Tableau:

This is the Data:

Is possible to have that problem solved by Tableau?