Wondering why metabase adds in some funky-ness when extracting day of week from a date column:
SELECT
PROCESSED_AT,
extract(dayofweek,PROCESSED_AT) correct_way,
CASE WHEN ((date_part("dayofweek", CAST("ANALYTICS"."DBT_PRODUCTION"."ORDERS"."PROCESSED_AT" AS timestamp)) + -1) % 7) = 0 THEN 7 ELSE ((date_part("dayofweek", CAST("ANALYTICS"."DBT_PRODUCTION"."ORDERS"."PROCESSED_AT" AS timestamp)) + -1) % 7) END AS metabase_way
from orders
order by 1 desc
Given yesterday was a tuesday, it should be 2, not 1. any idea whats going on here? for context i’m comparing using the ask a question tool vs SQLing myself