select
sum(O_TOTALPRICE + 1),
sum(O_TOTALPRICE + 1),
SUM(CUSTOMER_1.C_ACCTBAL)
FROM
TPCH.ORDERS as ORDERS
INNER JOIN TPCH.CUSTOMER as CUSTOMER
ON ORDERS.O_CUSTKEY=CUSTOMER.C_CUSTKEY
INNER JOIN TPCH.CUSTOMER as CUSTOMER_1
ON ORDERS.O_ORDERKEY=CUSTOMER_1.C_CUSTKEY
where CUSTOMER_1.C_ACCTBAL > 5000 -- derived dim
group by O_ORDERDATE

