solved: IstBestellwert = grouped.Sum(o => (double)o.SollMenge * (double)o.Preis) works
My SQL Statment
SELECT ABId, SUM(Preis * IstMenge) AS IstBestellwert, SUM(Preis * SollMenge) AS SollBestellwert
FROM vChainStoreOrderingDetails
GROUP BY ABId, FilialId
HAVING
(ABId = 10) AND (FilialId IN (8, 140))
my try in linq
from csod in db.vChainStoreOrderingDetails
where csod.Lieferdatum == lieferdatum && csod.ABId == ab.Id
&& filialen.Select(o => o.FilialId).Contains(csod.FilialId)
group csod by new
{
csod.ABId
} into grouped
select new
{
test =grouped.Sum(o=> new { test =((double) o.Preis * (double)o.SollMenge)})
});
but the select part doesnt work. How can i make a multiplication inside the grouped.Sum() so i sum the multiplikated value