# Multiple Time Range in dashboard - Specific day in previous week

**URL:** <https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676>\
**Category:** General\
**Created:** [November 7, 2019, 11:01am UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676 "2019-11-07T11:01:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amprantino](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@amprantino](https://community.grafana.com/u/amprantino)\
**Post date:** [November 7, 2019, 11:01am UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/1 "2019-11-07T11:01:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukaszsiatka](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/lukaszsiatka/32/8316_2.png) [@lukaszsiatka](https://community.grafana.com/u/lukaszsiatka)\
**Post date:** [November 7, 2019, 11:51am UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/2 "2019-11-07T11:51:48Z")

</div>

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:

```auto
now/w+1d

```

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

```auto
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:

```sql
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

---

<div class="post-metadata">

**Author:** ![turpedo](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@turpedo](https://community.grafana.com/u/turpedo)\
**Post date:** [November 7, 2019, 2:23pm UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/3 "2019-11-07T14:23:22Z")

</div>

Hello,

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

> [@Average of this week vs Average of Last week](https://community.grafana.com/t/average-of-this-week-vs-average-of-last-week/22679):
>
> Hello, We are using InfluxDB and I would like to know how can I compare a average of this hour vs the average of the same hour 7 days back. I have two queries below, that does gives me just the value but I can’t seem to find a way to do a math between two queries. I do not want to use an absolute value in the timerange as I want the system to use the current date & time and minus -7 days from now. SELECT mean(“value”) AS “Last 7 days” FROM “xxxxtablexxx”.“xxxtablexx” WHERE (“process” = ‘x’ A…

---

<div class="post-metadata">

**Author:** ![amprantino](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@amprantino](https://community.grafana.com/u/amprantino)\
**Post date:** [November 8, 2019, 2:25pm UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/4 "2019-11-08T14:25:48Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![mirzafaraz1101](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@mirzafaraz1101](https://community.grafana.com/u/mirzafaraz1101)\
**Post date:** [June 13, 2021, 1:23pm UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/5 "2021-06-13T13:23:47Z")

</div>

@lukaszsiatka @amprantino @turpedo Hello all, I have a similar kind of problem.  
I want the change time ranges of the data at the dashboard level using query grafana(using variable). I tried using this query but it doesnt funtion as expected ( {​​​"find": “terms”, “field”: “qrCodeSensor.keyword”, “query”: “importTime:now-1y to now”}​​​).  
Is it possible to do something like this? If Yes, then what would be the example query.

---

<div class="post-metadata">

**Author:** ![bferdinandes](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/bferdinandes/32/16960_2.png) [@bferdinandes](https://community.grafana.com/u/bferdinandes)\
**Post date:** [June 13, 2021, 9:03pm UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/6 "2021-06-13T21:03:42Z")

</div>

> [@mirzafaraz1101](#):
>
> I want the change time ranges of the data at the dashboard level using query grafana(using variable)

are you trying to achieve something like this…?  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/7/0/70d8c83dba7e2a0836b784cb2f995df3d8e43b97.png)  
legend:  
Call Count → call count based on selected time range (2021-01-01 to 2021-06-01)  
Last Call Count → call count based on Last Year’s selected time range (2020-01-01 to 2020-06-01)

if yes, reply to me  
if no, ignore me

by the way this is 2 years ago topic 😂

---

<div class="post-metadata">

**Author:** ![mirzafaraz1101](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@mirzafaraz1101](https://community.grafana.com/u/mirzafaraz1101)\
**Post date:** [June 14, 2021, 6:43am UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/7 "2021-06-14T06:43:31Z")

</div>

@bferdinandes Thank you for your reply.  
Yes I am looking for something similar. I want do pass a query in Variables to change the time-range of the data in comeplete dashboard. I also tried couple of queries for the same, but nfortunately doesnt function.  
Yes, this topic is very old, but found it on website and thought of giving a try.

---

<div class="post-metadata">

**Author:** ![schmal](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@schmal](https://community.grafana.com/u/schmal)\
**Post date:** [August 30, 2021, 8:13am UTC](https://community.grafana.com/t/multiple-time-range-in-dashboard-specific-day-in-previous-week/22676/8 "2021-08-30T08:13:31Z")

</div>

Hey mate 🙂  
Could you elaborate a bit more on this? I’m trying to show 2 different data lines in the Graph.  
One for 2021 and one for 2020. How did you do this? 🙂
