6 Replies Latest reply on Jan 31, 2018 9:59 PM by parikshit.shinge

    Difference of sales between 2 different dates

    parikshit.shinge

      Hi All,

       

      I have a weird requirement and I'm not able solve this.

      Data Source 1:

      Current year :

       

      ProductMonthSales
      AJan'18100
      AFeb'18200
      AMar'18150
      AApr'18300

       

      Data Source 2:

      Previous year :

       

      ProductMonthSales
      AJun'1750
      AJul'17100
      AAug'1775
      ASep'17200

       

      In Tableau, I need to show 3 tables:

      1. Current Year

          

      ProductJan'18Feb'18Mar'18Apr'18
      A100200150

      300

       

      2. Previous Year

       

      ProductJun'17Jul'17Aug'17Sep'17
      A5010075200

       

      3. Difference

       

      Product----
      A5010075100

       

      This 50 is difference between first column of Current Year table and First column of Previous Year table. Similarly for 2nd, 3rd & 4th. The difference is based on the ordering of month columns. There are filters provided for months of previous year & month of current year. user may select any months in Current Year table & any months in Previous Year table. The difference should be dynamically calculated based on filters selection.

       

      User wants to compare sales of any months from previous year with sales of any months from this year. This comparison should be based on ordering of months in both the tables.

       

      If user select 4 months in Current year & only 2 months in Previous Year, then output should be like:

           

      ProductJan'18Feb'18Mar'18Apr'18
      A100200150

      300

      ProductJun'17Jul'17
      A50100
      Product----
      A50100NULLNULL

       

      I thought one way would be to cross join these data sources and creating one-to-all mappings both ways but that would be tremendous data and I can't afford it. Can I do it using table calculations or any other way?

       

      Any help would be appreciated.


      Regards,

      Parikshit