sales_walk/sql/excel_query.sql

25 lines
646 B
SQL

SELECT
sw.bill_dba "Bill-To",
sw.ship_dba "Ship-To",
sw.dsm "DSM",
sw.budget_2024 "2024 Budget",
sw.shipments_2023 "2023 Shipments",
sw.shipments_2024 "2024 Shipments",
sw.open_orders_2024 "Open Orders",
sw.quotes "Quotes",
(shipments_2024 + open_orders_2024) - budget_2024 "Budget Delta",
(shipments_2024 + open_orders_2024) - shipments_2023 "YoY Delta",
sw.flag "Flag",
sw.bucket "Bucket",
sw.attainment "'25 Fcst vs '24 Bdgt - %",
sw.notes "YoY Notes",
sw.fcnotes "'25 Forecast Notes"
FROM
rlarp.sales_walk_r1 sw
WHERE
(sw.dsm = ?)
ORDER BY
sw.shipments_2023 desc,
shipments_2024 + open_orders_2024 desc,
quotes desc