Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a a column of dollar amounts that I want to calculate the running difference (opposite of sum() ? ) of. Does Reporting services have a diff function or something way that I can do a running difference on a column?

Example dataset:

Year  |    amt   | pts
2007  |  1500    | 0
2008  |  1200    | 10
2009  |  1800    | 0

what I'm looking to do is take a running difference of the amt column and another for the pts column. Something to get me to...

amt = -1500     // (1500 - 1200 - 1800) 
pts = -10       // ( 0 - 10 - 0)
share|improve this question

migrated from May 18 '12 at 16:30

This question came from our site for professional and enthusiast programmers.

running difference of what? – Diego May 17 '12 at 14:03
Need more information in order to answer this question. From your sample data, we can't really tell what's being operated on. – swasheck May 18 '12 at 19:01
@swasheck - I'm guessing that the first column is the year. Then he starts with the first value of the second column (1500) and it extracts every next row, so it would be 1500-1200-1800 = -1500; the same for the third column – Lamak May 18 '12 at 19:06

You can use an expression for the total that would look like this:

=SUM(iif(Fields!Year.Value = MIN(Fields!Year.Value, "YourDataset"),Fields!Dollar.value,-1*Fields!Dollar.value))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.