6 Replies Latest reply on Jul 2, 2018 8:41 AM by Mavis Liu

    Difference between columns in swap sheets

    Leandro Jora

      Hello Everyone!

       

      I have a project that I want to show all months of the year and when I choose a specific month I want to display the last month and make

      the difference between this months.

       

      I am using a parameter to choose the months.

       

      What I am trying use is to do like the image below.

       

      I attached the file to understand better the project.

       

      I will be glad for every help!

       

      Thanks a lot!

        • 1. Re: Difference between columns in swap sheets
          Mavis Liu

          Hi Leandro,

           

          You seemed to have made each component separately and you're combining them into one dashboard, can I ask why you're doing it this way?

           

          You should be able to create one table which has the selected and previous months against the groups, then another worksheet to create the difference view. You should only need two worksheets to get the view you want. Would you be able to let me know why you've built your view in this particular way?

           

          Thanks,

           

          Mavis

          • 2. Re: Difference between columns in swap sheets
            Mavis Liu

            Hi Leondro,

             

            I have created this view using two worksheets:

             

            2018-06-28_20h17_00.png

             

            The first sheet is to work out the month in the parameter, plus the month before. I have converted your month field into a date field and then used this calculation:

             

             

            2018-06-28_20h18_33.png

             

            I dragged this into the filters and set it to true such that only the selected month and previous month is shown in the view.

             

            Secondly I made the difference worksheet, to do this I applied a table calculation of 'difference':

             

            2018-06-28_20h19_36.png

             

            Then I used another table calc to hide all columns apart from the last:

             

            2018-06-28_20h20_09.png

             

            Please see the attached workbook.

             

            I would advise using this kind of method rather than using multiple worksheets for all elements. From your workbook, I can see you're making a sheet for every month, using my method above, it is much more straight forward and easier to maintain.

             

            Thanks,

             

            Mavis

            • 3. Re: Difference between columns in swap sheets
              Leandro Jora

              Hello Mavis, how are you!!

               

              Your solution was amazing!!

               

              Just a little detail, I don't know why the Option All doesn't work for me!

               

               

               

              Could you please, give me a hand with this?

               

              Thank a lot!!

              • 4. Re: Difference between columns in swap sheets
                Mavis Liu

                Hi Leondro,

                 

                This is because 'All' has not been linked in any way.

                 

                At this point, even if you select 'All', tableau does not know what to do with it because you haven't specified.

                 

                So you'll need to add it to the calculation:

                 

                2018-06-29_07h41_36.png

                 

                Question is, how do you want the difference to be calculated now?

                 

                At this point, if you select 'all' it will look at the difference between the final month (December) and compare it against November. Is this what you're looking for?

                 

                Please see the attached workbook.

                 

                Thanks,

                 

                Mavis

                • 5. Re: Difference between columns in swap sheets
                  Leandro Jora

                  Hello Mavis!!

                   

                  How is the weather in London?

                   

                  I would like some day to know this amazing city.

                   

                  Answering your question, I just want to calculate the difference when I choose to specify the month.

                   

                  Do you have some recommendation for this case?

                   

                  Sorry about many doubts, some times begginner doubts.

                   

                  You have been a great teacher.

                   

                  Thanks a lot!

                  • 6. Re: Difference between columns in swap sheets
                    Mavis Liu

                    Hi Leondro,

                     

                    London is fantastic thank you! Where are you from?

                     

                    So in this current dashboard, it will do what you're looking for.

                     

                    If you select April, it will find the difference between April and March. However if you select All, it find the latest month - December - and will compare it to November.

                     

                    Thanks,

                     

                    Mavis