SELECT
	customerid,
    SUM(amountposition) AS TotalAmount
FROM PortfolioAmounts
GROUP BY Customerid
HAVING TotalAmount > 70000;

WITH grouped_table AS 
(
    SELECT
        customerid,
        SUM(amountposition) AS TotalAmount
    FROM PortfolioAmounts
    GROUP BY Customerid )
    
SELECT *
FROM grouped_table
WHERE TotalAmount > 70000
