Changing time to a day before on x axis graph

I am trying to show a graph for users logged in per day and per month.
so what i am doing is querying number of yesterday’s and previous month number logged in users.
but on graph yesterday’s data would show on today’s timeline(eg- suppose if its tuesday and i query logged in users data for yesterday it would show on tuesday’s timeline in x axis in graph. i want to show today’s queried data on yesterday timeline in graph).
So is there a way i can change the x axis on grafana to a day before. I hope i was clear :sweat_smile:.

if i query data once a day on day end it shows a very thin line on graph so i thought above approach could be used. Any suggestions for implying this is welcome.

datasource- prometheus

Hi @mayurnegi1999,

I’m not sure I fully understand your issue (if I get it wrong a screenshot of what you’re currently doing/trying to do would help) but it sounds like you want to override the time range? Can take a look at Grafana’s Query options. More specifically the time shift option.

This allows you to override the time range for a specific panel. In your case, let’s say it’s Tuesday 3PM and your dashboard has a time range picked of 24h. If you want a specific panel to display the results from the day before, you could apply a time shift of 1 day (1d). This would display the las 24h of the day before (Sunday 3PM until Monday 3PM).

You can also use the Relative time to override the time range for an individual panel (eg. last 48h instead of 24h). Here’s a screenshot of what these options look like:

There’s also the option of doing it using the prometheus Offset modifier

Hope this helps!

1 Like

this is what I exactly needed. thnks for the help.