我有一个带有最后一列的表,其中total_service_time采用HH:MM格式从我的SQL查询中正确获取。
我在最后一行添加表达式= Sum(Fields!total_service_time.Value)时得到#Error,以获得HH:MM格式的total_service_time之和。
有没有办法以最后一行的HH:MM格式获得时间总和
我对total_service_time值的查询:
(SELECT CAST(total / 60 AS varchar(8)) + ':' + CAST(total % 60 AS varchar(2)) AS Expr1
FROM (SELECT CAST(SUM(Action.[Travel Time] + Action.[Total Productive Time]) AS int) AS total) AS T) AS total_service_time
Screenshot 谢谢, 萨勒曼
答案 0 :(得分:0)
您正在尝试总结其格式与SUM
不兼容的小时和分钟,以便添加您需要使用特定DATETIME
功能的小时和分钟。
试试下面的表达式 -
=Right("0" & Sum(CInt(Left(Fields!total_service_time.Value,2)), "<DataSetName>")
+ Floor(Sum(CInt(Right(Fields!total_service_time.Value,2)), "<DataSetName>") / 60),2)
& ":" & Sum(CInt(Right(Fields!total_service_time.Value,2)), "<DataSetName>") Mod 60
我正在尝试从小时开始计算总数,从总分钟中添加溢出,然后连接分钟。 参考 -
修改强> 根据要求的新表达 -
=SUM(Hour(Fields!total_service_time.Value)) + FLOOR(SUM(MINUTE(Fields!total_service_time.Value))/60) & ":" & SUM(MINUTE(Fields!total_service_time.Value)) Mod 60
修改强> 试试这个表达式 -
=Sum(CInt(MID(Fields!total_service_time.Value,1,INSTR(Fields!total_service_time.Value,":")-1)), "<DataSetName>")
+ Floor(Sum(CInt(Right(Fields!total_service_time.Value,2)), "<DataSetName>") / 60)
& ":" & Sum(CInt(Right(Fields!total_service_time.Value,2)), "<DataSetName>") Mod 60