Apptio for All

 View Only

 Subtract datetime values

Jump to  Best Answer
Rahul Talla's profile image
Rahul Talla posted Tue January 21, 2025 11:58 PM

Hi all, 

Was wondering if there is a workaround in TBM Studio to somehow calculate the difference of two date-time values. For my use case I would like to calculate the "time left" by subtracting a "Expiry date-time value" from the "current date-time value" using the Now() function.

i.e. Current time ( 21-01-2024 2:00 PM) minus Expiry date-time (20-01-2024 2:00 PM)  = 1 days 0 hours 0 mins

Thanks for your help :)

Michael Martinelli's profile image
Michael Martinelli  Best Answer

As Mario shared that help link should get you where you want.

https://help.apptio.com/en-us/studio/formulas-and-functions/functions/months.htm?Highlight=months

At the bottom of the page

The following example subtracts the number of months from the project start date to the project end date, and then multiplies the result by the cost per month.

=((Months(ProjectEnd)-Months(ProjectStart))*ProjectCostPerMonth)

Mario Luque's profile image
Mario Luque

Hello

Try to use the function "months" . You can apply some logic to calculate the difference with 2 dates.

https://help.apptio.com/en-us/studio/formulas-and-functions/functions/months.htm?Highlight=months

Best regards,

Mario

Rene Norskov's profile image
Rene Norskov

There is also the Elapsed() function that returns the difference in seconds between two dates.

https://help.apptio.com/en-us/studio/formulas-and-functions/functions/elapsed.htm