Importante: o script somente retorna os saldos maiores ou igual a zero, excluindo os negativos

select T.*,
T.SaldoEstoque * T.Custo as Total
from (select AP.IdFilial,
(select RazaoSocial
from Filial
where Id = AP.IdFilial) as Filial,
P.Id as IdProduto,
P.Nome as NomeProduto,
A.Id as IdAgrupamento,
A.Nome as Agrupamento,
UM.Sigla,
case
when CP.CustoUtilizadoVenda = 0 then
isnull(CP.ValorCusto, 0)
when CP.CustoUtilizadoVenda = 1 then
isnull(CP.ValorUltimoCusto, 0)
else
isnull(CP.ValorCustoFixo, 0)
end as Custo,
isnull(PP.Valor, 0) as Valor,
isnull(PP.PercentualMargemLucro, 0) as PercentualMargemLucro,
AP.Quantidade as SaldoEstoque
from Produto P
left join CustoProduto CP on (P.Id = CP.IdProduto)
left join PrecoProduto PP on (P.Id = PP.IdProduto),
Agrupamento A,
UnidadeMedida UM,
ApuracaoProduto AP,
Apuracao APU
where P.IdUnidadeMedida = UM.Id
and P.IdAgrupamento = A.Id
and AP.IdProduto = P.Id
and AP.IdFIlial = CP.IdFIlial
and AP.IdFIlial = PP.IdFIlial
and APU.Id = AP.IdApuracao
and APU.IdFilial = AP.IdFilial
and P.IdEmpresa = 1
and isnull(P.EhGorjeta, 0) <> 1
and isnull(P.EhTaxaEntrega, 0) <> 1
and APU.data = '30.04.2019') as T
where T.SaldoEstoque >= 0