Groups | Blog | Home
all groups > sql server reporting services > june 2006 >

sql server reporting services : Calculation between two rows


Alp Eren
6/9/2006 7:24:04 AM
Hi,

I have a table and data set to populate it. I need to calculate
difference between two rows (lets say the number of items below) and
want to show the difference on another column on each row as below.
Does anyone know how to do that?

Table

Name #Items Date Difference

Bla Bla 60 05-06-2006 -40
Bla Bla 100 05-06-2006 20
Bla Bla 80 04-06-2006 0

Regards,


Alp Eren YILMAZ
Ronald
6/9/2006 7:45:05 AM

Alp Eren schreef:

[quoted text, click to view]

Alp,

Something like currentmember-nextmember.........

Ronald
Sum12341
6/9/2006 7:58:02 AM
On the Difference column's textbox right click and click on Expressions and
type the folliwing
=Fields!Item.Value - Previous(Fields!Item.Value)

This will give you the desired result.

Sum.

[quoted text, click to view]
Alp Eren
6/10/2006 5:56:13 PM
Hi,

Thanks for the answers, a couple of tips


1- Change the sort order for the table data so you can use Previous
2- To reach the previous row data use Previous(..) function

= Previous( Fields!ColXXX.Value)-Fields!ColXXX.Value

MSDN Reference: http://msdn2.microsoft.com/en-us/ms156372(SQL.90).aspx

3- For the first row, avoid computation with iif and RowNumber(..)
check


Regards,

Alp Eren YILMAZ
AddThis Social Bookmark Button