Calculate the timedifference between two date_time measures

Hi

I have a table looking like the one below. Start Time and End time being measures, and days, hours and minutes being tablecalcs to calculate the time between the start and end times. Im using the diff_days/hours/minutes for this. 

Is it possible to create a table calc to calculate the time difference on a dd:hh:mm format? so it would, for this case have an additional column saying 01:01:36 ?

 

8be186a0-4bcf-4b01-989d-745dcb6c1e8f.png
2 3 6,244
3 REPLIES 3

Have a look at the dimension_group type: duration here https://docs.looker.com/reference/field-params/dimension_group#type_duration

This way you don’t have to create any table calculations

Becca1
New Member

Attempting to create the dimension group type:duration, but continue to get an error that the expression is incomplete.  Working on calculating elapsed time between start and end date/time. 

f1b49072-e66f-40a9-9c31-58b65860e61f.png

You could use this for a table calculation, but it does not pad zeros in the case of single digits (d:h:m:s format):

concat(
round(floor(diff_seconds(<your start time>,<your end time>)/60/60/24),0)
,":",
round(floor(mod(diff_seconds(<your start time>,<your end time>)/60/60,24)),0)
,":",
round(floor(mod(diff_seconds(<your start time>,<your end time>)/60,60)),0)
,":",
floor(round(mod(diff_seconds(<your start time>,<your end time>),60),0))
)
Top Labels in this Space
Top Solution Authors