I do not perform SUM with conditions in SQL Server
SELECT        cli_razon_soc, 
SUM(CASE WHEN t .fac_saldo_tot &gt; 500 THEN t .fac_saldo_tot ELSE 0 END) AS 'Mayor500'
FROM            cdc_vw_BuroCredito_Facturas95 AS t
GROUP BY cli_razon_soc, fac_saldo_tot
ORDER BY cli_razon_soc, 'Mayor500'


As the CASE operation is being applied to each row, checking the sum doesn't make sense logically. What we need to do for each row is check the value, if it's above 500 then sum it, else treat the value as 0.

The above code should accomplish this.