From 15da8aecd485e6ac9c40872f8939d5bea698ae0c Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 7 Mar 2023 16:07:55 -0500 Subject: [PATCH] reports --- inquirey/osmf_months.sql | 2 +- inquirey/osmf_months_shipped.sql | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 inquirey/osmf_months_shipped.sql diff --git a/inquirey/osmf_months.sql b/inquirey/osmf_months.sql index 0b69b0c..bca131d 100644 --- a/inquirey/osmf_months.sql +++ b/inquirey/osmf_months.sql @@ -6,7 +6,7 @@ SELECT ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2023 AND version IN ('actuals','15mo')),0) total_baseline ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2024 AND version = 'b23'),0) plan2024 FROM - rlarp.osmf o + rlarp.osmfs o WHERE oseas IN (2023,2024) AND substring(glec,1,1) <= '2' diff --git a/inquirey/osmf_months_shipped.sql b/inquirey/osmf_months_shipped.sql new file mode 100644 index 0000000..d739e28 --- /dev/null +++ b/inquirey/osmf_months_shipped.sql @@ -0,0 +1,21 @@ +SELECT + --o.glec + to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') order_month + ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE sseas = 2023 AND version IN ('b23') AND iter = 'actuals'),0) act2023 + ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE sseas = 2023 AND version IN ('b23') AND iter = 'actuals_plug'),0) act2023_plug + ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE sseas = 2023 AND version IN ('b23')),0) total_baseline + ,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE sseas = 2024 AND version IN ('b23')),0) plan2024 +FROM + rlarp.osmfs o +WHERE + sseas IN (2023,2024) + AND substring(glec,1,1) <= '2' + --AND quota_rep_descr = 'COLIN MAXWELL' +GROUP BY + ROLLUP ( + --o.glec, + to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') + ) +ORDER BY + --o.glec, + order_month