5 Replies Latest reply on Feb 16, 2017 9:28 AM by David Li

# Calculating DateDiff

Hi

how to calculate no of days in the following image

if the id is same for different regions and for each region i want to calculate the datediff

if region is west diff would be the west accept date and east end date

if region is north diff would be the north accept date and west end date

if region is south diff would be the south accept date and Norht end date

• ###### 1. Re: Calculating DateDiff

Hi Jilani, you can do this with a table calculation. For instance:

DATEDIFF('day', ATTR([End]), LOOKUP(ATTR([Accept]), 1))

Make sure this computes along Table (Down).

2 of 2 people found this helpful
• ###### 2. Re: Calculating DateDiff

Thanks.

can u send me without using the table calculations.

• ###### 3. Re: Calculating DateDiff

You can't do this in Tableau without table calculations.

• ###### 4. Re: Calculating DateDiff

ok because of regions are not in same order aswell as dates also

and that to i want to calculate only multiple regions having same id

if it is unique i dont want to calculate.

Thanks

• ###### 5. Re: Calculating DateDiff

You can set the table calculation to restart on every ID or you can modify the calculation, e.g:

IIF(ATTR([ID]) = LOOKUP(ATTR([ID]), 1), DATEDIFF('day', ATTR([End]), LOOKUP(ATTR([Accept]), 1)), NULL)