1.Correlation via TabPy
I did this because I would like to know how to set up the new Python extension: TabPy.
In Tableau 10.1, we can take advantage of TabPy. Alexander Loth has written a nice tutorial here. If you don't have GIT installed in your computer, you can just go to http://github.com/tableau/TabPy and download the package.
Use the script in the calculated field to calculate the correlation. His twbx file is no longer downloadable. I reproduced the file according to the image in the tutorial. Here is the file for you to download.
2.Correlation via Window_Corr()
In Tableau 10.2, there is a new function Window_Corr() which calculates the correlation between two vectors of aggregated measures.
By using the new function, I got exactly the same result as the one via TabPy. The window function has to compute along the "Customer Name" dimension.
This example is included in the same file.
Postscript
The one with TabPy can't be published to Tableau Public website because it doesn't support Python or R extension. Tableau Public desktop neither.
Note that there is a Corr() function which is for calculating the correlation between two non-aggregated values.
Hope this helps.
Add a comment