-- Invoices that are missing in Analytics
-- This report shows invoices that do not have a delivery date, so they are missing in analytics
-- FILTER: {
--   filter: "link",
--   column: "link"
-- }
-- FILTER: {
--   filter: "date",
--   column: "create_date",
--   params: {
--     "format": "m/d/y"
--   }
-- }

SELECT
    id,
    create_date,
    'https://simple123.com/agency/agencies/5656058538229760/invoices/' || id AS link
    FROM simplebrsprod.deal_cart
WHERE order_date > '01/01/00' AND delivery_date is null AND has_items = true
ORDER BY create_date DESC