2 Replies Latest reply on Oct 20, 2017 11:12 AM by Cecilia Saldaña

    Two years running total (calculating difference)

    Cecilia Saldaña

      Hello,

       

      I have a table with the following columns.

       

      DateAmount
      jan 201720
      feb 201730
      jan 201640
      feb 201625

       

      I want to get a chart displaying year by year data as shown in attachced image,,, including the difference between years (mont by mont).

      I get to the point where I can display month by month difference... but when I try to see (in the chart) the difference cumulative amount... i just cant...

       

      Captura de pantalla 2017-10-12 a la(s) 18.51.50.png

      The upper part is a cumulative chart comparing two years (light and dark blue each)

      The chart below is currently showing each month´s difference, but I want to see the cumulative difference...

       

      Any ideas?

       

      Thank you

        • 1. Re: Two years running total (calculating difference)
          Manuel Velasquez

          Hi Cecilia

           

          Not sure about the structure of your data or how you build your Viz, however, I will try to recreate something similar with Sample-Superstore data set, I only have data for 2015 and 2016, after I create a simple line graph  to see/ compare profit per month, I will create 3 calculated fields to get the difference per month

           

          Get the profit  just for 2015 & 2016 years with an IF THEN END Statement

          1.PNG

          2.PNG

           

          Now the difference between 2016 profit - 2015 profit

           

          3.PNG

           

           

           

          After you have the difference per month, then the cumulative difference is a Table Calculation Running Total (Table across ) [or RUNNING_SUM]

           

          4.png

           

          Then create the view

           

          5.PNG

           

           

           

           

           

          Attached .twbx file for reference (using Ver 10.2)

           

           

          Let me know if this helps!

           

           

          NOTE: I notice that you are using a Spanish version of Tableau, I speak Spanish too!

           

           

          Manuel Velasquez

          1 of 1 people found this helpful
          • 2. Re: Two years running total (calculating difference)
            Cecilia Saldaña

            Thank you,

             

            It works just fine.

             

            Greetings,