Hi Looker and Community,
We’re trying to use value_format
to nicely format a time value in seconds to
We found in numerous places on Looker’s discourse that we should divide the value by a day in seconds (86400.0).
As result when the value is 60/86400.0
our formatter shows 0 min 00 sec
.
Here’s the code in LookML that generates that:
measure: avg_time_to_attempt {
type: average
sql: ${seconds_duration_to_first_attempt} / (86400.0);;
value_format: " [<0]\"h\"; m \"min\" ss \"sec\""
}
We double checked that format in Excel, to see if maybe that how it’s supposed to be, but there it worked as expected showing 1 min 00 sec
.
[EDIT] We also found out this only happens for odd numbers, so for example:
60 seconds - 0 min 00 sec
120 seconds - 2 min 00 sec
180 seconds - 2 min 00 sec
240 seconds - 4 min 00 sec
300 seconds - 4 min 00 sec
360 seconds - 6 min 00 sec
At first glance it looks like a round up problems, but not sure why or where, especially if the very same formula works correctly in Excel.
Seems like a Looker value_format
bug, doesn’t it?