4 Replies Latest reply on Mar 8, 2012 12:51 PM by sophiegaudet

# How do you create a calculated field to represent in graph the gap between 2 means?

Quite simply, I would like to represent in a chart the difference (in # , not percentage)  between 2 means from 2 separate questions. Means are based on survey data.

• ###### 1. Re: How do you create a calculated field to represent in graph the gap between 2 means?

The approach will largely depends on how your data is structured. Can you share a sample?

• ###### 2. Re: How do you create a calculated field to represent in graph the gap between 2 means?

Here is a sample. The data are survey responses on a scale of 1-5. I simply would like to add either a sheet or addition to the graph that is a calculation of the mean for A1a. minus A2a. (and so forth for each item).

• ###### 3. Re: How do you create a calculated field to represent in graph the gap between 2 means?

With the data as in your sample, just create a custom calculation like:

AVG([A1A])-AVG([A1B])

You will need to repeat this to create similar calculations for every pair of scores that you want to compare (see attached for an example).

If you re-shape (unpivot) the same data using Tableau data re-shape Excel add-in, then you will only need one table calculation, and you can even use parameters to compare with every score. There are also other benefits in using this approach, see unpivoted examples in the attached workbook.

Table calculations are more complicated than the ordinary ones, but in return they can do a lot more.

• ###### 4. Re: How do you create a calculated field to represent in graph the gap between 2 means?

Thanks. Greatly appreciated. What would be great would be a course on representing survey data.