SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How the ssrs expressions works for DateDiff?


How the ssrs expressions works for DateDiff?

Author
Message
ashuthinks
ashuthinks
SSC-Enthusiastic
SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)SSC-Enthusiastic (134 reputation)

Group: General Forum Members
Points: 134 Visits: 199
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.
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38903 Visits: 38508
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.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search