Take the 2-minute tour ×
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. It's 100% free, no registration required.

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
7  
running difference of what? –  Diego May 17 '12 at 14:03
2  
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
1  
@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
add comment

migrated from stackoverflow.com May 18 '12 at 16:30

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

1 Answer

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
add comment

Your Answer

 
discard

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.