8 Replies Latest reply on Nov 13, 2018 2:56 AM by Amit M

    Correlation matrix

    Amit M

      Hi Guys,

       

      I am trying to build the correlation matrix view similar to the 2nd image but my view looks exactly opposite of what i needed (1st image). Before posting me my question, I have searched on forum to get the solution for the same but I didn't find any solution which fits in my requirements. I want to show the relation between different ages but it is showing only for the same ages. Please find attached the workbook crated in tableau 2018.2 version. 

       

      Highly appreciated your help on this.

       

      My view looks like below:

      current.PNG

       

      And I need to create the view like below:

      required results.PNG

        • 1. Re: Correlation matrix
          Zhouyi Zhang

          Hi, Amit

           

          Is it something like this?

          As you original key to join two data set will keep equal age records only.

           

          Hope this helps

           

          ZZ

          • 2. Re: Correlation matrix
            Amit M

            Thanks for replaying Zhouyi, is it possible to create the view(like staircase) similar to what I had mention in my question. I was following some article to accomplish it but did not get the exact solution.  And if you don't mind could you please explain what join condition 1=1 will do.

             

            If we could achieve the correlation matrix using single data source without duplicating the data source, It would be great to know that.

             

            thank you so much for your response.

             

            Regards,

            Amit M

            • 3. Re: Correlation matrix
              Zhouyi Zhang

              Hi, Amit

               

              You need change the filter somehow as below

               

              To your question, the key 1=1 is just meaningless, but it cross join your data sets, and join your data to itself is the way to achieve this.

               

              Hope this makes sense.

               

              ZZ

              1 of 1 people found this helpful
              • 4. Re: Correlation matrix
                Amit M

                Thank you Zhouyi it helps me to get my desired results. I have added the condition which you have mentioned in the screenshot, in my existing calculated fields.

                 

                Just one question, I have to create the charts for all the variables present in my worksheet for example Rbc which is a string type and we can not apply corr() function on it so is there any workaround you would suggest to achieve it.

                 

                once again Thank you,

                • 5. Re: Correlation matrix
                  Ombir Rathee

                  You can convert string to integer/float using int/float function and use that calculated field in Corr function

                   

                  INT(RBC)

                  FLOAT(RBC)

                  • 6. Re: Correlation matrix
                    Amit M

                    Hi Ombir, The Rbc field actually have the string values. So my question is how could I use the corr() function for Rbc dimension.

                     

                    Thanks for your response.  

                    • 7. Re: Correlation matrix
                      Ombir Rathee

                      Corr function in tableau only works for continuous variables. However, you can convert string to integer values by mapping dimension members to numbers like High=1, Medium=2, Low=3 etc.

                       

                      If you're familiar with R/Python then it would be easy with SCRIPT functions in Tableau to check correlation between categorical variables.

                      • 8. Re: Correlation matrix
                        Amit M

                        Hi Ombir, Thanks a lot for your time and response. I have multiple fields around 14 which has the string values and i need to create the single correlation matrix for all of them. If R would give a better option within a tableau I would be happy to explore more on this.

                         

                        This thread is closed so I have created another thread which I had opened for creating a single correlation matrix for all the variables.

                         

                        Correlation matrix for Multiple Variables (25 fields)

                         

                        Request you to  please respond on above thread. I would be waiting for your response, if you have any suggestion.

                         

                        Thank you Ombir.