hourSelection() over two days

Hello all,
i am new of this topic and need a little bit help.
I would like to divide a working day into 3 shifts.
However, the night shift lasts 2 days but it doesn’t work.

hourSelection (start: 21, stop: 5)

Thank you for the help in advance.

Hello @Fana,
I can run that function with those parameters and without any error.
What is your input, the rest of your query, and your expected output?
Thanks

Good Morning @Anaisdg ,

thx for your answer. My query is:

Fruehschicht = from(bucket: line)
|> range(start: -14d)
|> filter(fn: (r) => r._measurement =~ /_test_bottle_burst/ and r.status == “Good”)
|> hourSelection(start: 4, stop: 12,)
|> aggregateWindow(every: 24h, fn:last, )
|> map(fn:(r) => ({Fruehschicht:r._value,time:r._time }))
|> yield(name:“Fruehschicht”)

Spaetschicht = from(bucket: line)
|> range(start: -14d)
|> filter(fn: (r) => r._measurement =~ /_test_bottle_burst/ and r.status == “Good”)
|> hourSelection(start: 12, stop: 21,)
|> aggregateWindow(every: 24h, fn:last, )
|> map(fn:(r) => ({Spaetschicht:r._value,time:r._time }))
|> yield(name:“Spaetschicht”)

Nachtschicht = from(bucket: line)
|> range(start: -14d)
|> filter(fn: (r) => r._measurement =~ /_test_bottle_burst/ and r.status == “Good”)
|> hourSelection(start: 21, stop: 5,)
|> aggregateWindow(every: 24h, fn:last, )
|> map(fn:(r) => ({Nachtschicht:r._value,time:r._time }))
|> yield(name:“Nachtschicht”)
|> sort(columns: [“Fruehschicht”, “Spaetschicht”, “Nachtschicht”])

for this grafana shows me only “Fuehschicht” and “Spätschicht”.