Group into time period


I need to create a table in Grafana showing produced units per shift.

To do so I sum each 15m reading. When grouping into 1h it works but what if I want to group by shift?

Day-shif=> 06 - 14
Evening-shift => 14 - 22
Night-shift => 22 - 06

Datasource is influxdb

Kind regards