如何在SSRS表达式中编写以下SSRS计算
下面的实际计算示例
=((deldate+deltime) –(orddate+ordtime))*24
deldate delTime orddate ordTime *24
13/01/2015 14:25 14/01/2015 13:55 23.50
20/01/2015 12:00 20/01/2015 17:02 5.03
这适用于SQL Toad,但不适用于SSRS
(TO_DATE(TO_CHAR(A.DELDATE,'DD/MM/YYYY') ||' '|| TO_CHAR(A.DELTIME,'HH24:MI'),'DD/MM/YYYY HH24:MI') - TO_DATE(TO_CHAR(A.ORDDATE,'DD/MM/YYYY') ||' '|| TO_CHAR(A.ORDTIME,'HH24:MI'),'DD/MM/YYYY HH24:MI'))*24 AS "DiffinHours",
答案 0 :(得分:2)
将TO_CHAR
更改为Format
,将TO_DATE
更改为CDate
,并使用DateDiff
代替减去。要获得小数小时数,请找出以分钟为单位的差异除以60.0:
=DateDiff(DateInterval.Minute,
CDate(Format(Fields!deldate.Value, "MM/dd/yyyy") & " " & Format(Fields!deltime.Value, "HH:mm")),
CDate(Format(Fields!orddate.Value, "MM/dd/yyyy") & " " & Format(Fields!ordtime.Value, "HH:mm"))
) / 60.0