Código SQL:
Ver originalSELECT Fecha, Proveedor, [Nivel 1], [Nivel 2], [Nivel 3], SUM(Monto)
FROM ProveedorNiveles
WHERE Proveedor = 'AC1890BD'
AND [Nivel 1] = 'XX'
AND [Nivel 2] = 'XXXX'
AND Fecha = (SELECT MAX(fecha) FROM ProveedorNiveles WHERE datepart(yyyy,fecha)=datepart(yyyy,getdate())-1)
GROUP BY Fecha, Proveedor, [Nivel 1], [Nivel 2], [Nivel 3]
saludos!