I get the error . . . You tried to execute a query that does not include the specified expression "SellName" as part of an aggregate function.
I can't figure it out in this example.
The third set of Sum(iif . . . produces incorect results.
What am I missing here?
Thanks, Rick . . .
SELECT Scmls.ListName, Scmls.SellName, Scmls.SalePrice,
Sum(IIf(Scmls.ListName And Scmls.SellName Like Scmls.ListName,1,0))*2 AS WSO,
Sum(IIf(Scmls.ListName And Scmls.SellName Like Scmls.ListName,Scmls.SalePrice,0))*2 AS WSODV,
Sum(iif(Scmls.ListName <> Scmls.SellName,1,0)) AS TSO,
Sum(iif(Scmls.ListName <> Scmls.SellName,Scmls.SalePrice,0)) AS TSODV,
Sum(iif(Scmls.SellName <> Scmls.ListName,1,0)) AS WST,
Sum(iif(Scmls.SellName <> Scmls.ListName,Scmls.SalePrice,0)) AS WSTDV,
WSO+TSO+WST AS [Total Transactions],
Sum(IIf(Scmls.ListName,Scmls.SalePrice,0)) AS[Listing Dollar Volume],
WSODV+TSODV+WSTDV AS[Listing and Sales Dollar Volume]
FROM Scmls
GROUP BY Scmls.ListName
ORDER BY 10 DESC;