Flux.How to display today’s and yesterday’s data on the same panel?

Im using grafana + influxdb (fluxlang), to show data collecting every minute, how can i show yesterday’s data from the same time on the same pannel ? for today’s data im using the query

from(bucket: "test")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) =>
    r._measurement == "stal" and
    r._field == "value" and
    r.component == "players"
  )

Hello @TheFatal,

So are you looking to shift values?
And have data for different days overlap on the same minute and time vaulues?

import "array"

today = 
array.from(rows: [{_time: 2020-01-02T00:00:00Z, _value: 1},
{_time: 2020-01-02T00:01:00Z, _value: 2 }])
|> yield(name: "today")

yesterday = 
array.from(rows: [{_time: 2020-01-01T00:00:00Z, _value: 2},
{_time: 2020-01-01T00:01:00Z, _value: 3 }])
// include "_start", "_stop" in your example for timeshift
// timeShift(duration: 10h, columns: ["_start", "_stop", "_time"])
|> timeShift(duration: 24h, columns: [ "_time"])
|> yield(name: "yesterday")

ty for your answer, i tried that way but it did not work, im getting non yesterdays values :frowning:

my code:

from(bucket: "test")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> timeShift(duration: 24h, columns: ["_start", "_stop"])
  |> filter(fn: (r) =>
    r._measurement == "stal" and
    r._field == "value" and
    r.component == "players"
  )

at last i did it, tnx agein for your help, here is a correct query:

import "date"
from(bucket: "test")
  |> range(start: date.sub(d: 1d, from: v.timeRangeStart), stop: date.sub(d: 1d, from: v.timeRangeStop))
  |> timeShift(duration: 1d, columns: ["_start", "_stop", "_time"])
  |> filter(fn: (r) =>
    r._measurement == "stal" and
    r._field == "value" and
    r.component == "players"
  )