Time series widget not displaying data when selecting static time ranges in sql

I do measurements in different testing installations and on different testing batches.

So I filter the measurement data based on two user defined variables called “_installation_id” and “_batch_id”.

I would like to display the measurements using the “Time series” widget.

For this purpose I created the following sql statement:

  pot AS "time",
  value_desc_varchar AS metric,
FROM grafana_data
  pot BETWEEN '2021-07-01 07:00:00'AND '2021-07-01 10:00:00'
  AND installation_id=$installation_id
  AND batch_id=$batch_id
  AND value_desc_varchar IN
    'Temp. oben rechts',
    'Temp. oben links',
    'Temp. mitte rechts',
    'Temp. mitte links',
    'Temp. unten rechts',
    'Temp. unten links',
    'Temp. Schornstein'

However the widget only displays my data when I do select the appropriate time filter on top of the page. It seems there is some underlaying filtering based on the time filter lies above the sql statement.

How can I manage to show the content using the static selection above (pot BETWEEN '2021-07-01 07:00:00’AND ‘2021-07-01 10:00:00’) without the need to use the time filter in addition to that?

Using the same timeframe as in the sql statement

Using a different timeframe