1 Reply Latest reply on Jun 4, 2012 11:21 PM by Richard Leeke

# Calculation Syntax in Tableau

I'm new to Tableau and a non-programer and I'm having an overly difficult time trying to figure out the syntax for calculations in Tableau.  In the product manual there are examples of what the functions will do to a number (and I'm hoping Tableau generated dimensions), but examples of calculations syntax seem to be missing.

It seems the most prolific users in this (very helpful) community have programming backgrounds, I'm starting to get discouraged that this is a requirement to get the most out of the software.  Are there any resources that outline how to build a complex calculation in Tableau?

For practice I'm trying to do a simple BMI calculation as follows:

My first shot at this in Tableau is:  [Current Weight]/((EXP(2) = [Height])*703  which doesn't work but I don't know why.

EXP(2 ) = [Height] works to raise the height to the second power, but I can't seem to figure out how to use it in a calculation.

My goal for this practice viz was to calculate BMI, and then color results within the resulting weight categories, however I can't seem to get off square one.  The resource that I'm missing are the "rules" for building calculations, am I missing a kb article, or do you have to be a programmer to (really) use Tableau?

Thanks for any help with the above example, I really am trying to read the manual as much as I can, but I'm still missing the rules for calculations.

• ###### 1. Re: Calculation Syntax in Tableau

I'm not sure what resources there are these days, but I'm pretty sure that one of the online training videos covers calculations pretty well.

In terms of your example, what you want is:

( [Current Weight] / SQUARE([Height])) * 703

EXP(2) is actually returning you the mathematical constant e (Euler's number) to the power of 2, so your expression:

(EXP(2) = [Height])

is actually testing to see if [Height] = e^2 - which was not what you wanted at all!

If you click on a function name in the calculated field editor you will get a brief description of the function:

Hope that helps.