我正在处理水晶报告,并且对摘要有疑问 - 我有一批数据,其中包含三个级别的摘要:
"ordinv_rec"."activity"
"ordinv_rec"."op_region_2"
"ordinv_rec"."operator"
这是我的查询:
SELECT "ordinv_rec"."activity", "ordinv_rec"."status_2", "ordinv_rec"."operator_2", "ordinv_rec"."quote_no", "ordinv_rec"."vehicle_class_2", "customer"."veh_capex_2016", "ordinv_rec"."date_created", "ordinv_rec"."capex_value", "ordinv_rec"."activity_2", "ordinv_rec"."sub_class_2", "ordinv_rec"."budget_yn", "ordinv_rec"."budget_year", "ordinv_rec"."op_region_2", "customer"."activity"
FROM "dbase"."dbo"."customer" "customer"
FULL OUTER JOIN "dbase"."dbo"."ordinv_rec" "ordinv_rec" ON "customer"."customer_code"="ordinv_rec"."operator"
WHERE "ordinv_rec"."date_created">={ts '2015-01-01 00:00:00'}
AND ("ordinv_rec"."status_2"='DELIVERED' OR "ordinv_rec"."status_2"='LETTER OF INTENT' OR "ordinv_rec"."status_2"='LIVE')
AND ("ordinv_rec"."budget_year"=0 OR "ordinv_rec"."budget_year"=2016)
基本上,该"customer"."veh_capex_2016"
字段显示该运算符的单个值,例如 100 英镑,我需要在 "customer"."veh_capex_2016"
和我的 VARIANCE 公式之间计算方差,{customer.veh_capex_2016}-{@Total Committed YTD}
但将其插入摘要中会返回多个值。即{customer.veh_capex_2016}
乘以订单数,然后减去{@Total Committed YTD}
而不是仅返回单个字段值
非常感激地收到任何帮助或建议。