From an interval to a numeric value

Hello everyone,

I havec got a table like this and i would like to transforme "Moyenne des moyennes" from an interval to a numeric field :

In the above case I would like a value like this : 259,83

Thank you.

I suggest you use a native function of the database to do a datediff and transform the value to a number, e.g. in postgres

EXTRACT(DAY FROM date1-date2) AS date_diff_in_days

Metabase does not support date diff functions natively yet

1 Like

Careful using EXTRACT with specific types such as DAY, MINUTE etc as it only returns that type, no fractions.
Difference between midday today and midday yesterday, in minutes will be zero.

Better to use EPOCH as it returns seconds. You can then divide that down as necessary

1 Like