4 Replies Latest reply on Sep 27, 2018 8:13 PM by meenu choudhary

# Translation from Oracle to Tableau formula

I have two datetimes - order_time and result_time I need to convert them to numbers so I can subtract one from the other to get the length of time between them (that the lab result took to come back)

this is how I did it in Webi driving by Oracle:

=DaysBetween([Order_Time];[Result_Time]) * 1440 + ( ToNumber(FormatDate([Result_Time] ;"HH")) * 60 + ToNumber(Left(FormatDate([Result_Time] ;"mm:ss") ;2))) - (ToNumber(FormatDate([Order_Time] ;"HH")) * 60 + ToNumber(Left(FormatDate([Order_Time] ;"mm:ss") ;2)))

I am pretty sure it's much simpler syntax in tableau calculated field but it seems to be so simple that no matter what I try I can't figure it out - so wondering if anyone can help.  I've tried converting each to int() but that came back with a super wierd number that made no sense - so there is obviously more to it than that.  thanks.

• ###### 1. Re: Translation from Oracle to Tableau formula

Mel,

Di you try DATEDIFF('day', Order_time, Result_time)?

• ###### 2. Re: Translation from Oracle to Tableau formula

Hello Mel,

Are you looking for getting difference between two dates in minutes. If yes. you can try below logic:

time difference in minutes =

DATEDIFF('day',[Order Date],[Result Time])*24*60

+DATEDIFF('minute',[Order Date],[Result Time])

• ###### 3. Re: Translation from Oracle to Tableau formula

Yes that’s what I needed!

Sent from my iPhone

• ###### 4. Re: Translation from Oracle to Tableau formula

If your problem is resolved, please mark my answer as correct so as to close the thread and help others who are having similar queries.