Though it's possible to write something using the expression editor, it's probably more straight forward to do most of the work in the SQL statement in the dataset. If it's a large dataset, performance will definately be enhanced by aggregating in the SQL (dataset) portion of the report first. Here's one way I can think of handling this off the top of my head. (There are probably many more.)
SELECT
[Gov Type],
[Activity CD],
COUNT([Activity CD]) AS Expr1,
--calculate the negative value of Active CD for D3s and display in a new column
CASE WHEN [Activity CD]='D3' THEN COUNT([Activity CD])*-1 ELSE COUNT([Activity CD]) END AS Exp2
FROM ActsDeactsQuery
WHERE [Gov Type]='State & Local' and ([Activity CD] IN ('AC','D3')
GROUP BY [Gov Type], [Activity CD]
ORDER BY [Activity CD]
The dataset would have the following results:
State & Local AC 3646 3646
State & Local D3 219 -219
Then, in Reporting Services, if the requirement were still to display all values as positive, it would be easy enough to display Exp1 in the detail section of the report, while displaying the total of Exp2 in a (Activity CD) group underneath it. The expression would look something like this:
=Sum(Fields!Exp2.Value)
In my experience with Reporting Services, if it's easy enough to do in a SQL statement, it's a lot more efficient to aggregate the data in SQL first and then using Reporting Services for the presentation, rather than relying on Reporting Services to do all the work.
Look for more material on this topic in a future tip...
Best Regards
Rob Fisch