1 Reply Latest reply on Jun 19, 2018 9:28 AM by Ken Flerlage

    how to sum in tableau for last year of the same date

    kamal kumar

      Hi Everyone,


      I quite new to tableau and have been trying to do sum based on condition. let me explain. i have a net fees column and second is year column. sum condition should be like below. i want to calculate the difference of net fee of last year vs this year.


      so if year = 2008 then sum[net_fees] of 2007


      so basically the criteria is 2008 however, it should give me the sum of net fees of 2007 year. so that i can see the growth .


      an early response from your end will be appreciated.Place image

        • 1. Re: how to sum in tableau for last year of the same date
          Ken Flerlage

          I'd join the data source to itself. Take for example the attached Excel sample. It has two columns, Year and Net Fee. Join them together using a join calculation as shown below. Make sure the join is a left join so that you do not drop the first year, which will not have a prior year match.


          This will result in 4 fields -- Year and Net Fee of current year and Year and Net Fee for prior year.



          From there, you can just do some simple math to get the difference, etc. It's made much simpler because both current and prior year data are now on a single row.



          See attached Excel sample and Tableau workbook.


          If this solves your problem, please be sure to mark this answer as correct. Thanks!