Calculating Days Between Two Dates

Hi,

In my table, I am trying to create a new column that assigns each row to a group based on the date ("datefield"). To do this, I am calculating: now() - datefield

However, this calculation above returns "days 00:00:00.000". For example, if today's date and the datefield are 5 days and 1 hour apart, it returns: "5 01:00:00.000".

In order for me to assign these rows to a group (eg., <5 days dif, 5-10 days dif, 10-20 days dif, etc.), then this needs to be an integer. How can I convert this value "days 00:00:00.000" in Metabase?

Hi @saleksevitch
I don't know which database you are querying with, but have a look here:
https://stackoverflow.com/questions/17833176/postgresql-days-months-years-between-two-dates
Metabase currently doesn't support interval:
https://github.com/metabase/metabase/issues/2656

Thanks for your response here. It sounds like Metabase cannot support this functionality then?

Honestly, calculating the # of days between two dates seems like pretty simple logic so I'm surprised to hear that.

@saleksevitch There's an issue open about adding the functionality in the UI:
https://github.com/metabase/metabase/issues/11330 - upvote by clicking :+1: on the first post