How to convert time duration(Ex.. like 1d 5h 12m 25s from 55678900 seconds )

Hi,

i am a looker developer i need to create one look.

i have a dimension called duration,

dimension: duration{

type: number

sql:${table}.duration 

when i am using this i am getting only numbers as a output.(Ex.. 500000 ) , number=seconds

i need to convert (ex.. format like 1d 2h 20m 55s)

i dont have idea on this.

can you help on this

regards,

gk vardhan

0 3 475
3 REPLIES 3

I'm not sure if you solved it, but what I managed to do was to create a table calculation to transform those seconds into days (e.g. ${duration} / 24 / 60 / 60) and then format the data as hh:mm:ss 

how can I convert this to an integer or decimal, I need to create an alert by using that field but for that, I need to convert the duration to a integer or decimal

Hi GK Vardhan,

To convert the 'duration' dimension from seconds to the format "1d 2h 20m 55s" in Looker, you can use LookML's convert_tz function or a custom measure with Looker's liquid templating. Feel free to ask for more details.

Top Labels in this Space
Top Solution Authors