Include InfluxDB prices in electricity consumption

Hello all,

I am currently in the process of setting up a dashboard for my PV system.
I try to make sure that all data in the selected time period are correct.
However, I am still unsure about the design when calculating the prices.
Since the prices will probably change in the next few years, I have to use a different price depending on the time period in which the consumption was measured.
I was thinking of creating a bucket which has a start and end time in addition to the electricity price.
Aber wie würde ich darauf in einem Querry zugreifen um Preis auszurechnen.

Example Querry to get measurment data:

  from(bucket: "ioBroker")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "")
  |> filter(fn: (r) => r["_field"] == "value")