Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 How do I compare a row value to another row value

Author  Topic 

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2008-10-09 : 11:49:09
...and display the result on each row of the report?

We get a data feed at 15 minute intervals. I want to check the timestamp of the current row against the timestamp of the previous row and display the difference in a column, to make sure we don't have any gaps or repeating rows.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-09 : 12:19:04
are you asking for T-sql solution or report expression?
Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2008-10-09 : 13:32:40
Sorry, a report expression.
Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2008-10-09 : 14:12:48
This is as far as I've gotten:

=datediff(m,Previous(Fields!dtime.Value) ,Fields!dtime.Value)

and I keep getting the error that 'name 'm' has not been declared'.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-09 : 14:17:11
try like this
=datediff(month,Previous(Fields!dtime.Value) ,Fields!dtime.Value)

Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2008-10-20 : 11:12:59
Turned out the correct statement was:

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

The report server did the date conversion implicitly.
Go to Top of Page
   

- Advertisement -