2 Replies Latest reply on Dec 12, 2016 4:11 AM by Nikunj Bhardava

    Tableau Calculation for 3 months average for each current month

    Nikunj Bhardava

      Hi All,

       

      Is it possible to club last three months data for each current year?

       

      Example : If we have data like as below

       

      01/2016 -- A - 12

      02/2016 -- A - 13

      03/2016 -- A - 6.5

      04/2016 -- A - 7.8

      05/2016 -- A - 8.9

      06/2016 -- A - 1.5

      07/2016 -- A - 1.9

      08/2016 -- A - 2.1

      01/2016 -- B - 11

      02/2016 -- B - 11

      03/2016 -- B - 6.3

      04/2016 -- B - 7.3

      05/2016 -- B - 8.6

      06/2016 -- B - 1.6

      07/2016 -- B - 1.9

      08/2016 -- B - 2.4

       

      If user selects A then it will show monthly trend that is single value for each month

      If user selects B then it should show clubbed data for each month. i.e for each month it should show last three months average, so output will be like this

       

      For A

      01/2016 -- A - 12

      02/2016 -- A - 13

      03/2016 -- A - 6.5

      04/2016 -- A - 7.8

      05/2016 -- A - 8.9

      06/2016 -- A - 1.5

      07/2016 -- A - 1.9

      08/2016 -- A - 2.1

       

      and For B

      01/2016 -- B -  NULL (as we dont have last three months)

      02/2016 -- B - NULL (as we dont have last three months)

      03/2016 -- B - 9.43 i.e (same as last row calculation)

      04/2016 -- B - 8.2  i.e (same as last row calculation)

      05/2016 -- B - 7.4 i.e (same as last row calculation)

      06/2016 -- B - 5.83 i.e (same as last row calculation)

      07/2016 -- B - 4.03 i.e (same as last row calculation)

      08/2016 -- B - 1.96 i.e last three month average ((08/2016+07/2016+06/2016)/3)

       

      Any help will highly appreciated!!

       

      Thanks,

      Nikunj