I have a db table that looks like this:
PurchaseID | ItemName | ItemColor | PurchaseDate
1 | Car | blue | 11-03-12
2 | Plane | red | 12-03-12
3 | Car | green | 11-03-12
I need an report that provide following info:
ItemName (distinguished) | Number of purchases before @DateX(parameter from user) | Amount of green items purchased |
I can fill first column with all distinguished item names, but have no idea what to do with others…
As far as I know it’s not possible to insert an SQL query to expression (is it so?).
I’m not very experienced in SQL, maybe it’s possible to fill all report columns with single query?
Use an if statement inside a sum aggregate. Grouped by
ItemName, columns are:=Fields!ItemName.Value=Sum(IIf(Fields!PurchaseDate.Value < Parameters!DateX.Value, 1, 0))=Sum(IIf(Fields!ItemColor = "green", 1, 0))