23 lines
1.1 KiB
SQL
23 lines
1.1 KiB
SQL
SELECT
|
|
--o.glec
|
|
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month
|
|
,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2019 AND iter = 'actuals'),0) act2019
|
|
,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2019 AND iter = 'actuals_plug'),0) act2019_plug
|
|
,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2019 ),0) total_baseline
|
|
,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2024 AND version = 'b24'),0) plan2024
|
|
,ROUND(SUM(fb_val_loc * r_rate) FILTER (WHERE oseas = 2024 ),0) full2024
|
|
FROM
|
|
rlarp.osmf o
|
|
WHERE
|
|
--oseas IN (2023,2024)
|
|
substring(glec,1,1) <= '2'
|
|
--AND quota_rep_descr = 'COLIN MAXWELL'
|
|
GROUP BY
|
|
ROLLUP (
|
|
--o.glec,
|
|
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon')
|
|
)
|
|
ORDER BY
|
|
--o.glec,
|
|
order_month
|