Multiple Time Range in dashboard - Specific day in previous week

Hello all,

I want to create graphs in a dashboard and override the time range for the graphs.
Is there a way to match “previous Monday” or "previous Thursday " in the override section?
Its like “last calendar Monday” without respect for the current time of day.

For example, last Monday could be:

Override relative time “1d”
Add time shift “7d”

but the dashboard should always run on Monday. Additionally, the time doesn’t fit from 00:00 to 23:59 but is shifted according to current time.

Is there a way to match “previous Monday” ?

Thank you

Hi, @amprantino!

There’s no option to select “previous Monday” in the time picker, but you can select “custom time range” and type a query like:

now/w+1d

and that’s going to select you Monday of the current week. For Monday of the previous week, use:

now/w-1w+1d

You can also deal with it on the panel level. When you set up a graph, you can add the time region (available under visualization -> thresholds & time regions), but it includes a timezone offset. As long as your datasource supports SQL, you can write an appropriate query to cast dates and then group your data by these dates appropriately.

e.g. with postgres:

SELECT current_date - cast(extract(dow from current_date) as int) + 1;

to get the datetime object representing the very beginning of Monday.

Best regards,
Lukas

Hello,

Inline to what was asked in this, do you think what asked in this feasible?

In the meantime I found a similar solution:

Select time: Today
In the graphs Edit > Time Range > Add time shift: 2d/d or 3d/d etc …

Then by selecting Monday (using customer range) I always have the requested day in the graphs.

I am using Grafana v5 and the "now/w-1w+1d " or "now/w-1w+2d " is not accepted :frowning: