Date filter - last reading


#1

Hi there!

Would it be possible to add “last reading” to date filters? I have some tables which are not updated frequently so filters like “last XX days” are not actually working well. It would be great to have something like “last reading” filter. Or even better - to create dates range using last reading as right boundary. In other words - something like we already have in date filtering, but using LAST DATE IN TABLE instead of CURRENT DATE.

I hope I explained clear, but just to be sure, I mean something like (postgres syntax, assuming that we have table called cost_table with cost and date fields):

SELECT cost
FROM cost_table
WHERE date >= (SELECT max(date) - '30d' :: INTERVAL FROM cost_table)

Thanks in advance!