I'm using the GROUPED BY Hour of day to show the business day performance.
Our Business day lasts 18 hours, starting from 11AM and ending at 4AM. I really need to change the start hour in the result to 11AM (and end hour at 4AM) in order to have the graph related to the real working day hours and not to have 0 columns for the hours in-between.
Hi @Elis_15
You would have to do that in SQL and change the axis to Ordinal, while also ordering with a timeshift.
There's currently no simple way of handling this in Metabase by using the GUI.
SELECT CAST(extract(hour from "public"."Drinks"."createdAt") AS integer) AS "createdAt", count() AS "count"* FROM "public"."Drinks" LEFT JOIN "public"."IngredientQuantity" "IngredientQuantity" ON "public"."Drinks"."id" = "IngredientQuantity"."drinkId" LEFT JOIN "public"."Ingredients" "Ingredients - IngredientId" ON "IngredientQuantity"."ingredientId" = "Ingredients - IngredientId"."id" LEFT JOIN "public"."AppOrders" "AppOrders__via__appOrderId" ON "public"."Drinks"."appOrderId" = "AppOrders__via__appOrderId"."id" WHERE ("public"."Drinks"."type" = 'customer' AND "public"."Drinks"."alcohol" = TRUE AND "public"."Drinks"."barId" = 1 AND "public"."Drinks"."status" = 'delivered' AND "AppOrders__via__appOrderId"."createdAt" >= timestamp with time zone '2022-09-01 00:00:00.000Z' AND "AppOrders__via__appOrderId"."createdAt" < timestamp with time zone '2022-10-01 00:00:00.000Z') GROUP BY CAST(extract(hour from "public"."Drinks"."createdAt") AS integer) ORDER BY CAST(extract(hour from "public"."Drinks"."createdAt") AS integer) ASC
@Elis_15 Change the order clause to something like this:
ORDER BY CAST(extract(hour from "public"."Drinks"."createdAt") AS integer)+(CASE WHEN CAST(extract(hour from "public"."Drinks"."createdAt") AS integer)<11 THEN 23 ELSE 0 END) ASC
And then change the visualization Settings > Axes > X-axis scale = Ordinal