Getting days to today

Hi! I need to calculate days between a given date and today.
I couldn't find a today() function or similar

I have calculated days when I have a finish date as a new column
Days=[day_end] - [days_begin]

to get a mean at the end,
but I need to calculate days a job is waiting (so they dont' have ending date)

Maybe this can be helpful for you DatetimeDiff

but there are some limitations depending on which DB you are running

Thanks!
but what I don't have is today date... the diff between dates, just with a END-BEGIN works...
I need something to get today's date like today() now() GetSysDate....

A workaround would be to create a Native SQL question ... Something like select *, today() from bla bla ... and then use this question as the datasource in your GUI question

thanks, I was trying to avoid SQL since is a rapport made by users themselves.

Thanks anyway

You will only be using the SQL to create the today() column they would then use the GUI and connect to the Question you have created. For the users should be seamless

1 Like

thanks but... which sql function works? neither today, getdate, sysdate....

Depends on which Database you are using.

In postgres - SELECT CURRENT_DATE ;
In Mysql - SELECT CURDATE();
...

Google should be your friend here. But in summary you would create a question in SQL which would be fed as a datasource in the GUI ... another option would be to create a view in your database with the today column that would be generated on the fly and for metabase that column would be a normal table column which can be used in the GUI

Finally!! thanks
sysdate AS "DATA_FI"

1 Like

Here again with the same... it could be nice to have a function to get today date without going to sql question.

Try Now

thanks!!! a lot of thanks!!!!!!