How to set the end date of a timeseries chart to the last date in the series?

I have time-based data that is updated every now and then and I would like to show the date range as

  • ideally: <last date in series>-6M → <last date in series>
  • would work great as well: now-6M → <last date in series>
  • worst case 1: <date I get from a query to my data source>-6M → <date I get from a query to my data source>
  • worst case 2: <start date I get from a query to my data source> → <end date I get from a query to my data source>

In other words: base the date range on the content of the data (specifically the time).

Is this possible?

EDIT: In a way I would like to have the inverse of automatic variables. With them I can adapt my query to data from the dashboard - and I would like to adapt the date on the dashboard from the query.

what is your data source? please provide some sample data?