Graph panel overlaying historical data


I am trying to find a way to overlay historical data over specified date range by the date time picker on a dashboard on a graph panel.

For example, the date time picker on a dashboard set to show data for the last 24 hours. I have a graph panel that should show data for the last 24 hours but I want to also show the same time range but 1 month ago and 1 year ago on the same panel.

The data source is MS SQL and looking at generated SQL query, the __timeEpoch macro generates DATEDIFF in seconds, I guess one can probably manipulate that part but what about WHERE clause with __timeFilter macro?

Thanks a lot, and any help will be highly appreciated!

I think the issue here is that I want to achieve the functionality of having multiple historical views on the same panel.

For examples:

The main graph on graph panel will show last 24 hour data. On the same panel I want to be able to show the same 24 hour period but last week, last month, 3 months ago, 1 year ago.

It is possible to replicate this functionality by adding multiple queries (A,B,C etc) and then manually setting period of interest and relative historical shifts.

However it would be excellent if there was a way to manipulate $__timeFilter(column) macro so that one could specify how many days or months to adjust. Like: $__timeFilter(column, day, -365).

The $__timeEpoch(column) macro can also benefit from time shift adjustment. Like: $__timeEpoch(column, day, 1)

Hope it makes sense.

Hi serge1, did you ever get a solution for this? I’m also wanting to display this year and last year on the same panel. It doesn’t make sense to have to go back and forth between graphs to measure the differences.