Limit the time frame for some panels


I have data for the past two years. Now I would like to limit a few panels in terms of the time frame that can be set. For example I want a few specific panels to ignore the data from before 2017. So if I choose the time frame January 2016 to February 2017 on the upper right hand corner in Grafana, I want those panels to only display the data for January and February of 2017.

How is that possible?


Maybe :slight_smile:

I’ve gotten similar questions to this a few times now so I decided to add two new quick ranges - This month so far and This year so far. But I’m not sure if that is what you are asking for. Do you want to exclude March, April and May?

Anyway, if This year so far is a good solution you can use today’s build (or if you wait a week it will be included in the 4.3.0 release).

The new quick ranges can be used in the Time Range override feature for the Graph Panel in the Override relative time field (now/y for this year so far and now/M for this month so far):

This is really cool, but its not totally clear how to translate a quick range to relative time + timeshift in a panels Time range.
More specifically I’m trying to have a table panel show summary data for “Yesterday”

I don’t understand exactly what you are asking. Is it Yesterday together with a time shift? Here is Yesterday with a time shift of 1h:

Thanks for the prompt reply :slight_smile:

I want the panel to show data from yesterday 00:00:00 to yesterday 23:59:59 - just like using the quick range "Yesterday"
1d/d set the “from” correctly, but the panel will show data until now, so I have been trying to use last 1d, but cannot seem to generate a time shift that corresponds to current time

Aha. This is want you want I think:

This part of the graph panel needs a UX update. It is way too hard to figure this out.

Actaully that produces a range from 27/05 00:00 until 28:05 23:59 - 2 days worths!

ok, this is a bit weird. Override relative time set to this day so far (now/d) and then time shifted one day + rounded up/down (1d/d). This is a bit of hack rather than something that should actually work…

1 Like

I’ll take it anyway
Thanks for you help :slight_smile:

1 Like


I hope you will help me to solve my problem/
I use datasourse Postgresql. I can’t set up “Time range” for panel singlestat.
I want to see value for last week, last month.
What i should write

Like this if you mean last week: (today is the 24th so last week is from the 14th to the 20th)

The UI changed a bit in one of the latest releases, is there any manual which value I can use for time/date calculations?


You can always manually set the query, which ignores any date ranges top right. You could have a filter in your where statement incorporated with the top right time filters. i.e. Filter out time less than January 2017.

In my case I get sunrise/sunset data once a day. My dashboard defaults to 6 hours so no data comes in after 6 hours goes by. I just ignore the $timeFilter since I only want the last record. Here is an example of manually editing the query:


I had a similar requirement for showing yesterday’s 24 hours data. I tried with the following

Time Shift: 1d/d
Relative Time: 0s

This works for me. Hope this helps you as well.

1 Like