5 Replies Latest reply on May 31, 2017 2:29 PM by Jim Dehner

# Is it possible to do a table calculation on a date field?

Hi,

I want to run a table calculation that returns the difference between the actual week number so that I can do some calculations based on the difference.

Looking at the screenshot below,  I want to be able to get the difference between the week numbers so: week 9 minus week 10= -1

is this possible? I have attached my workbook.

Thanks,

Andrew

• ###### 1. Re: Is it possible to do a table calculation on a date field?

Hi Andrew,

Here you go.

The trick is to use Datepart( )

Step 1:

Step 2:

Step 3:

Step 4:

Please see the attached for more details.

Thanks,

Yemeng

• ###### 2. Re: Is it possible to do a table calculation on a date field?

This is not correct. I need the difference between the week numbers within the farthest right column. I want the difference between the weeks of the calling dates. The date field means nothing nor do I need it in the calculation.

Using product x1 for example going down the table: I want to see week 9 minus week 10= -1; week 10 minus week 12= -2

Thank you,

Andrew

• ###### 3. Re: Is it possible to do a table calculation on a date field?

Something like this?

Not quite sure what you want to achieve.

• ###### 4. Re: Is it possible to do a table calculation on a date field?

Hey Andrew,

PFA the workbook as well developed in Tableau 10.2

1 of 1 people found this helpful
• ###### 5. Re: Is it possible to do a table calculation on a date field?

Hi - I posted this on the other thread you have on this issue

I am on a different version but will walk you through the calculation

The date difference calculation is      DATEDIFF('week',min([Calling Dates]),lookup(min([Calling Dates]),-1))

where you do the table calculation DOWN

Let me know if this helps

Jim