How the ssrs expressions works for DateDiff?

  • I'm working on SSRS reports there is on column i.e Holding period where we actually calculate for

    how many days the company is hold in our database (we compare with buy date)

    and ssrs expression is

    =DateDiff(DateInterval.Day, Fields!BuyDate.Value, First(Fields!Date.Value, "DailyPosition"))

    Which is coming wrong could any one help to execute correct calulation.

    Buy date is a normal date column from table , and "DailyPosition" is my dataset name from ssrs report.

    for example Company ABC buy date is 2012-03-13 00:00:00.000 and last parameter date is 2012-12-31 00:00:00.000

    below query giving me result as 293 select DATEDIFF (day,'2012-03-13 00:00:00.000','2012-12-31 00:00:00.000')

    which is wrong as my holding period is 126 days only

    please help me to correct the expression.

  • ashuthinks (4/15/2013)


    I'm working on SSRS reports there is on column i.e Holding period where we actually calculate for

    how many days the company is hold in our database (we compare with buy date)

    and ssrs expression is

    =DateDiff(DateInterval.Day, Fields!BuyDate.Value, First(Fields!Date.Value, "DailyPosition"))

    Which is coming wrong could any one help to execute correct calulation.

    Buy date is a normal date column from table , and "DailyPosition" is my dataset name from ssrs report.

    for example Company ABC buy date is 2012-03-13 00:00:00.000 and last parameter date is 2012-12-31 00:00:00.000

    below query giving me result as 293 select DATEDIFF (day,'2012-03-13 00:00:00.000','2012-12-31 00:00:00.000')

    which is wrong as my holding period is 126 days only

    please help me to correct the expression.

    Not sure how 293 is wrong as it is the number of days between '2012-03-13 00:00:00.000' and '2012-12-31 00:00:00.000'.

    Without more information I'm not sure how we can help.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply