1 Reply Latest reply on Sep 21, 2016 4:45 PM by diego.medrano

# Replace current months records with last month's records

Hi All,

This is a challenging task for me.Please give me some inputs to resolve this.

My report is refreshed on weekly basis.I have the below fields in my data.

1.) Week- Week1,Week2 and so on Week 52.

2.) LossclaimMonth; it consists of months.

3.) Refresh Month: This will populate the current "month" name whenever data is refreshed

4.) Sales

5) other fields as well

In the below snapshot, below are two examples for my requirement.

Example 1:  If suppose I have refreshed the data on the first week of August(Suppose that week Number is Week 5), then

current week=Starting week of "August" Month and the Week number would be "Week 5". So "Current Week"=Week 5. And the last week would be Week- 4 which is July's refresh month Last Week(last Week of Refresh month=July). then I should get July last Week Sales value should be equal to July Current Week Sales  value as shown below:

Suppose Refresh week='Week 5'

 Lossclaim Month last Week current Week July \$245 \$245

For the other months ,values will vary.

Example 2:  If suppose I have refreshed the data on the first week of September(Suppose that week Number is Week 9), then

current week=Starting week of "September" Month and the Week number would be "Week 9". So "Current Week"=Week 9. And the last week would be Week- 8 which is August's refresh month Last Week(last Week of Refresh month=August). then I should get August last Week Sales value should be =July Current Week Sales value as shown below:

Suppose Refresh week='Week 9'

 Lossclaim Month last Week current Week July \$245 \$245 August \$347 \$347

and so on . This should repeat for every month.

You can observe one thing in the above Week 9 table is that July values are same as in Week 5 July values. this ,means that from Week 5 onwards,

the July \$245 value should be constant for all the upcoming weeks.Means, for Week 5,Week 6,Week 7 ,Week 8 and so on will have lossclaimonth=july's value as \$245.

Similarly,

From Week 9 onwards,the August \$347 value should be constant for all the upcoming weeks.

Means, for Week 9,Week 10,Week 11 ,Week 12 and so on will have lossclaimonth=August's value as \$347.

This happens only when current moth's records are replaced with previous months records. but i do not know how to do in tableau.

This might be bit complicated doing in tableau.If there is answer in tableau, then i will be much much happy.

please let me know if you need any information.

Best Wishes,

Sandeep

• ###### 1. Re: Replace current months records with last month's records

Hey Sandeep,

What happens if you create a new connection and try to replace the data source?

-Diego