3 Replies Latest reply on Jan 15, 2019 4:28 AM by Shinichiro Murakami

    How to calculate data on Last X visits of different dates

    Abdul Aleem Imam

      I need to calculate sum of last x visits of different dates of each individual store which has a unique store id

      For example

       

      Store Id = X001

       

      Visit IDVisit DateData
      N00112/8/20181
      N00214/9/20181
      N00315/10/20181
      N00422/10/20181
      N00523/12/20180
      N00610/1/20191

      If X= 4 then the sum should be  3 ( of last 4 visits on that store  N006, N005, N004, N003)

      If X= 2 then the sum should be 1 ( of last 2 visits on that store N006, N005)

      If X= 3 then the sum should be 2 ( of last 3 visits on that store N006, N005, N004)

       

      I need to do this for every store