8 Replies Latest reply on Feb 5, 2019 12:57 PM by Paul Wachtler

# Sum of a Calculated Field

Hi,

I am new to Tableau and have been trying to figure out how to get the sum of  a column of calculated values. For example, the amount in local currency and exchange rates are from my data source. and The Investment in USD is basically a calculation by multiplying the amount and exchange rate.

When I tried to apply grand total, I only get a total of the "amount in local currency" column. The total for "Investment in USD" is blank.  I tried to use running_sum, but that's just a work around as I don't want just one value for the total. I also tried Window_sum but it didn't work.  please help!

Currency
Amount in Local Currency
Exchange Rate
Investment in USD
USD20120
EURO301.1434.2
RMB1,0000.15150
Grand Total1,050

thanks,

Heidi

• ###### 1. Re: Sum of a Calculated Field

Did you try this already --

• ###### 2. Re: Sum of a Calculated Field

{FIXED [currency] : SUM([Investment in USD])}

• ###### 3. Re: Sum of a Calculated Field

Thanks Tim.

this calculation returns the "argument to SUM (an aggregate function) is already an aggregation, and cannot be further aggregated.

The column with the "amount in local currency" is the sum of amount over across multiple investors i.e. sum(). could this be the problem?

• ###### 4. Re: Sum of a Calculated Field

Hi Arvindgarg,

yes i did try that and it returned null for total value of investment.

thanks,

Heidi

• ###### 5. Re: Sum of a Calculated Field

So, this is what i see with adding the grand total

• ###### 6. Re: Sum of a Calculated Field

Have you posted a sample of your work in a twbx file?  I am driving home but can look when I get there. For now, take the sum off of your earlier work. The field is required to be an aggregate in the LOD calculation.

Sent from the iPhone of Timothy Dines.

• ###### 7. Re: Sum of a Calculated Field

I am getting correct values using grand total.

Also, see in second workbook, what do you have there. Try changing to some other options.

Can you attached packaged workbook?

• ###### 8. Re: Sum of a Calculated Field

Hi Heidi,

You can wrap the calculation you used for Investment in USD in the sum() function like this:

sum([Amount in Local Currency] * [Exchange Rate])

Best,

Paul