-- Total Sales by Distributor Group
-- Description
-- FILTER: {
--   filter: "date",
--   column: "Send_Date",
--   params: {
--     "format": "m/d/y"
--   }
-- }
-- FILTER: {
--   filter: "class",
--   column: "total_sales",
--   params: {
--     class: "text-right"
--   }
-- }


SELECT deal_cartitem.distributor_group, to_char(sum(deal_cartitem.operator_total_price), '$999,999,999,999') total_sales
FROM simplebrsprod.deal_cartitem deal_cartitem
WHERE deal_cartitem.cart_is_purchased=True
GROUP BY deal_cartitem.distributor_group;


