0 Replies Latest reply on Apr 9, 2018 11:38 PM by Karthika Subramani

    How do I make a reference of Pivot Field Values in a Regression equation?

    Karthika Subramani

      Hi all,


      I am working on the data where I am required to transform the data into a pivot table in tableau and then pull all the required charts and analysis.


      I am required to do regression analysis for which I have integrated R with tableau. Now the issue is while using the SCRIPT function how will I refer/indicate which is dependent variable and which all are independent variables in the regression formula, as after transforming all the variable will be referred as "Pivot Field Names" and "Pivot Field Values".


      Formula Used:-


      fit<- lm(.arg1 ~ .arg2 + .arg3 + .arg4)




      [Pivot Field Values]



      Also note, we have multiple columns which needs to be clubbed under single header (Like Store 1,2,3 & 4 as "Stores"). Likewise, we need to club the other variables i.e.Location, Age Category and WTD. We have created multiple sets (for Stores, Location, Age Category & WTD)  and then tried performing regression analysis, not sure what am I missing out,  I am getting an error message,


      Looking for an tableau output as below:


      Store1                   ****

      Store2                   ****

      Store3                   ****

      Store4                   ****


      Here is the attached Sample workbook along with sample data and R error screenshot.


      Your immediate response would be highly appreciated. Many Thanks!


      Kind regards,