Adding time period range for Prometheus Data

Hello, I am fairly new to Grafana.
I used Prometheus as my data source and used pushgateway in a python script so I can display it in Grafana. I currently have a bar gauge with following query:

sum by (date) (timestamps_per_day)

A timestamp looks like this 2024-06-24-22-49-59.000678 and that just sums up the amount per day to display in the dashboard, e.g. 2024-06-24 → 9 (timestamps).

I want to be able to add a time period/range that filters the bar gauge dates in the data based on the current time, e.g. I have timestamps for the past 3 days and want to filter the bar gauge to only show the dates for the last 2 days from the data.

How do I do this?

Thank you.