如何使用Reporting Services表达式从上一个值中减去一行的值?

时间:2013-01-02 20:01:44

标签: reporting-services reportingservices-2005

使用以下SQL查询:

SELECT     
   TOP (100) PERCENT 
   ID_BADGE, 
   LEFT(RIGHT('000000' + CAST(TIME_TRX AS varchar), 6), 2) 
     + ':' + SUBSTRING(LEFT(RIGHT('000000' + CAST(TIME_TRX AS varchar), 6), 4), 3, 2) AS ClockTime, 
   DATE_TRX, SEQ_REC, ROWID
FROM
   omi.TAHIST_ZERO
WHERE     
   (ID_BADGE = '     ' + @Badge) 
   AND (DATE_TRX BETWEEN @Date AND @Date2) 
   AND (SEQ_REC IN ('0', '1000')) 
   AND (CODE_TRX IN ('100', '101'))
ORDER BY 
   DATE_TRX, TIME_TRX

我创建了下表:

screenshot of ssrs table

使用 Reporting Services表达式我想从ClockTime的第三个值中减去ClockTime的第二个值。

我查看了VB函数,我找到的只有First,Last,Min和Max,而不是第二或第三。

1 个答案:

答案 0 :(得分:1)

我认为您可以使用SSRS Previous函数实现此目的:

http://msdn.microsoft.com/en-us/library/ms156372(v=sql.90).aspx