Group by time() query



I have a question about querying data when using group by time(7d) for example.

In that case when my first data entry was made on a Sunday, I don’t get any results until the next 7 days have passed. This does not look so nice on graphs when you don’t see any progress the whole week.
Is there a possibility to query using group by time(7d) + last() for example?



Can you provide an example of the query you’re running now?


My query looks like the following:

select max(*) from /.*/ group by time(7d);

and the result looks like this:

2018-03-22T00:00:00Z 4              48            70       87040
2018-03-29T00:00:00Z 5              51            73       90112
2018-04-05T00:00:00Z 3              48            70       88576
2018-04-12T00:00:00Z 3              48            70       88576

until yesterday the output contained as last entry 2018-04-12, starting today I get also the line of today:

2018-04-19T00:00:00Z 3              48            70       88576                                       

What I would like to achieve is to get the all the results plus the last entry, so that yesterday I would have received an additional line for 2018-04-18 or the day before 2018-04-17. Or better in my opinion would be group by time as inverted order, so that I would the 7 days range would start from today back, but order by does not the trick.

I suppose I have to implement this in my backend logic and to query the last myself and merge results?