5 Replies Latest reply on Jun 8, 2016 9:24 PM by Ashish Chaudhari

# How can we calculate difference between 2 weeks?

Hi All.

I'm The beginner of tableau, Can anyone please help me the how can we resolve the issue?

Here I attached 1 dashboard image. I took 2 worksheets one sheet is june 1st week report and another one is 2nd week report, here the week is a string field is not a date field

and here I dragged the location into row shelf and dragged the week into the column shelf and dragged the number of records into Marks card Text . here how can we calculate the

difference from both weeks? which formula Can I use? Please let me know

• ###### 1. Re: How can we calculate difference between 2 weeks?

any possibility of sharing workbook?

-Ashish

• ###### 2. Re: How can we calculate difference between 2 weeks?

Hi Asish,

I attached 1 sample workbook, Here My scenario is regions wise 1st week total availability 19 and same like 2nd week availability 21 and 3rd week availability 11. Here I want to calculate the difference between all weeks availability, Like current week total values compared with previous week and the difference.

Please let me know How can we achieve this ?

• ###### 3. Re: How can we calculate difference between 2 weeks?

Hi Suresh,

For your kind of data we will have to take the pivot by doing following. I have also attached the tableau workbook to the thread but I doubt it will work for you as it is in tableau 9.3 version.

Select the Week 1, week 2, week 3 and right click. This will change your data structure as below.

Then you can create the below structure using Pivot field Names(week1,week2,week3) and Pivot field values(Availability,New Hire, Nominated).

Create the structure as below.

for % Difference Right click on the Number of records and click on "Add Table Calculation"

And Do the following

You will get the required result.

Thanks and Regards,

Ashish Chaudhari

• ###### 4. Re: How can we calculate difference between 2 weeks?

Hi Asish,

I have One doubt, When we pivot the columns our total records increased 60 to 180, Almost 3 times increased on our current records. So how can we get exact records.

Thanks,

• ###### 5. Re: How can we calculate difference between 2 weeks?

Hi Suresh,

Your data is transposed data where you are having less columns. If we transpose the data there will always be increase in the number of records.

Thus we won't get the original number of record. Any particular reason you want number of Original records?

-Thanks

Ashish