Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reporting services Datediff函数还将startdate日期添加到输出中_Reporting Services_Reportbuilder - Fatal编程技术网

Reporting services Datediff函数还将startdate日期添加到输出中

Reporting services Datediff函数还将startdate日期添加到输出中,reporting-services,reportbuilder,Reporting Services,Reportbuilder,我在ReportBuilder1.0中有一个报告,其中我编写了一个公式,用于计算startdate和enddate之间的天数。为此,我以如下方式使用了DATEDIFF函数: DATEDIFF(DAY, TODAY(), column from table which has end date) 假设,如果今天的日期是2013年7月1日&该列将结束日期发送为2013年7月10日,则DATEDIFF函数返回“10天”,而它应将输出值返回为“9天”。为什么返回的是10天而不是9天?在Sql Serv

我在ReportBuilder1.0中有一个报告,其中我编写了一个公式,用于计算startdate和enddate之间的天数。为此,我以如下方式使用了
DATEDIFF
函数:

DATEDIFF(DAY, TODAY(), column from table which has end date)

假设,如果今天的日期是2013年7月1日&该列将结束日期发送为2013年7月10日,则DATEDIFF函数返回“10天”,而它应将输出值返回为“9天”。为什么返回的是10天而不是9天?

在Sql Server中执行此操作,您将得到9天:

select DATEDIFF(day, '2013-07-01', '2013-07-10')
将其用作数据集:

select CAST('2013-07-01' AS DateTime) AS StartDate, CAST('2013-07-10 23:59:59' AS DateTime) AS EndDate
然后在SSRS中使用此表达式:

=DateDiff(DateInterval.Day, Fields!StartDate.Value, Fields!EndDate.Value)
即使使用时间组件,仍然可以产生9天。请尝试以下表达式:

=DateDiff(DateInterval.Day, DateTime.Today, Fields!EndDate.Value)
您是否显示日期字段以确保您认为应该得到的是您实际得到的?例如,确保没有返回缓存数据。

DATEDIFF(DAY,TODAY(),TARGET FINISH(TARGETFINISH))--我为在报表生成器中创建的新字段编写的公式。没有其他方法可以写出这个公式///一天-一场辩论,只能这样写。没有别的办法///TODAY()-我使用了报表生成器中可用的from date time函数来获取当前日期///目标完成(TARGETFINISH)-这是表中的一列,我从中获取值----整个公式给了我错误的计算。而不是9,输出为10。请帮忙!!为了澄清问题——我在报表生成器中定义公式,而不是在ssrs中编写表达式。