1 Reply Latest reply on Jul 18, 2014 4:10 AM by Ben Leathers

# Help needed!

Hello everyone,

I am trying to figure out how I could write a calculated field in tableau that would give me a time passed between two events. For example, a gift card was bought at a store  on 7/10/14 at 12:00:00AM and registered on 7/12/14 at 1:00:00PM

and I need to get the time it took from the time card was bought to the time it was registered. This is how the data would look,

Date        Time                     Transaction                       Account Number                Name                  State

7/10/14      12:00:00AM        Card Acquired                      xxxxxxxx                              xxxxx                     xx

7/12/14       1:00:00PM         Card Registration                  xxxxxxxx                              xxxxx                     xx

xxxxxxx            xxxxxx            xxxxxxxxxxxxx                    xxxxxxxx                              xxxxx                     xx

xxxxxxx            xxxxxx            xxxxxxxxxxxxx

If there were ten cards bought and registered how would I get the time elapsed on average between acquisition and registration for those ten people.

Thanks!!

• ###### 1. Re: Help needed!

Hey Jenny,

I believe the answer to this problem is the same as your vintage data question plus a couple of steps.

You need to reconfigure your data such that you have 1 row for each card, a column for card acquired date/time and card registered date/time, and you should be able to write a calculated field something like:

Name: Time Until Card is Registered

Formula:

DateDiff('second',[Card Registered],[Card Acquired])

Assuming each card only has one registration and activation date you can do a Window_AVG(sum([Time Until Card is Registered])) and you would need to 'compute using' some kind of card ID, I believe.

I still don't have a firm enough grip on Table Calculations to say that with confidence, especially without seeing a sample workbook.

As a note, you get better and more answers when you attach a workbook with your problem.

If you're concerned about confidentiality I recommend creating a set of dummy data, even if it's small.

I hope this helps!