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

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

• ###### 1. Re: How to calculate data on Last X visits of different dates

Here you go.

 Store ID Visit ID Visit Date Data Store1 N001 1/1/2018 1 Store1 N002 1/2/2018 1 Store1 N003 1/3/2018 1 Store1 N004 1/4/2018 1 Store1 N005 1/5/2018 0 Store1 N006 1/6/2018 1 Store2 N007 1/7/2018 1 Store2 N008 1/8/2018 0 Store2 N009 1/9/2018 0 Store2 N010 1/10/2018 0 Store2 N011 1/11/2018 1 Store2 N012 1/12/2018 0 Store2 N013 1/13/2018 1 Store3 N014 1/14/2018 1 Store3 N015 1/15/2018 1 Store3 N016 1/16/2018 1 Store3 N017 1/17/2018 0 Store3 N018 1/18/2018 1

Step 1 specify the data in range

Step2 sum by store

Step3 filter and layout, format.

Thanks,

Shin

• ###### 2. Re: How to calculate data on Last X visits of different dates

Hi Shin,

Thank you very much for the response.

Can you please tell me how can I specify the date range in it?

For example I want to take sum of data of latest X visits  in a specified date range.

• ###### 3. Re: How to calculate data on Last X visits of different dates

Add date filter and change that filter to context.

Shin