3 Replies Latest reply on Mar 2, 2012 1:32 PM by gabrielgriggs0

# Plotting calculated correlation coefficient

Hi,

Based on a helpful example from this forum, I have been able to create a correlation coefficient calculated field.  Based on the example data set, I have no problems plotting the 2 measures and showing the calculated correlation coefficient as a text value.

However, I'd like to take this 1 step further and plot the correlation coefficient itself rather than the 2 measures across time and cities.

In the data set example provided, we can see that the calculated coefficient values are:

- Cincinatti (Oct): 0.91

- Seattle (Oct): 0.97

- Spokane (Oct): 0.87

- Cincinatti (Nov): 0.97

- Seattle (Nov): 0.96

- Spokane (Nov): 0.97

Therefore, how do I generate a plot which will show me only 6 points for correlation coefficient for Spokane/Seattle/Cincinatti for Oct-Nov ??

Thanks

CK

• ###### 1. Re: Plotting calculated correlation coefficient

What you need to do is arrange for Tableau to see all the details it needs to calculate the correlation coefficients (by having the date, month and identifier dimensions in the view, as you have) but only include the correlation coefficient measure in the view.  That almost gives you what you want - but you have multiple rows for each city/month combination (one for each identifier).

So you need a filter which acts after the calculated field has been evaluated to limit it to one row per city/month.  You can't just filter on identifier or Tableau wouldn't see all of the rows it needs.  The trick here is that filters on table calculations are not applied until after table calculations have been evaluated.  You can just define a field using the INDEX() table calculation function and display just the first row of each partition (say) using a filter on that calculated field.  Example attached.

• ###### 2. Re: Plotting calculated correlation coefficient

Thank you sir - that is exactly what I was looking for.  Greatly appreciated..

• ###### 3. Re: Plotting calculated correlation coefficient

Hi Richard,

I am working on a problem that is similar to this one (as far as I can tell).

Can you think of a way to do this: http://community.tableau.com/thread/116245 ?

Thanks,

Gabe