Louis A
Louis A

Reputation: 1

How to calculate Ride length between two date/time columns in Tableau?

I have two columns in tableau "Started_time" and "ended_time", they are both in "date/time" format, when i try to calculate the "total duration" from these two columns it always pulls up data as a string.

My goal is to caculate the AVG time in "total duration" and when i try to do a caculation with this newly calculated column "total duration" an error pops up "AVG cant do a calculation on a string".

enter image description here

[enter image description here]

enter image description here

I dont know if I should go back to SQL and change the data type to float???

Upvotes: 0

Views: 88

Answers (1)

sargentiny
sargentiny

Reputation: 1

Your second two images are the same (Started Time). Double check that both are in the Date/Time format. For total duration, create a Calculated Field and try using the DATEDIFF function:

DATEDIFF('month', [Started_time], [ended_time])

Change the interval (substitute month with years, weeks, days, etc.)

More info on Date Functions here.

Upvotes: 0

Related Questions