SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Date Field not showing correct Date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tech2
Starting Member

37 Posts

Posted - 03/29/2013 :  08:33:12  Show Profile  Reply with Quote
SSRS Report Builder 3.0 2008 R2

My query results is showing the current date, not the date in my date field 'StatusDate'

I also created a calculated field named 'CurrentDate' and trying to get my 'datediff' column 'StatusDays' to calculate the correct days.

Any help would highly be appreciated.

=DateDiff("d",Format(Fields!StatusDate.Value,"Short Date"),Format(Fields!CurrentDate.Value,"Short Date"))

Thanks,

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 03/29/2013 :  13:42:53  Show Profile  Reply with Quote
id StatusDate is of type datetime, you need just this
=DateDiff("d",Fields!StatusDate.Value,Now())


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

tech2
Starting Member

37 Posts

Posted - 03/29/2013 :  15:42:09  Show Profile  Reply with Quote
Thanks for the response; After using your expression below; The dates in the 'statusdate' field are still coming back as the current date.

I'm sure your expression works but there is something that has to be included in the formula that will keep the dates from changing.

thanks,

quote:
Originally posted by visakh16

id StatusDate is of type datetime, you need just this
=DateDiff("d",Fields!StatusDate.Value,Now())


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3546 Posts

Posted - 03/29/2013 :  21:46:29  Show Profile  Reply with Quote
that sounds like the issue is more with the query used to populate the dataset rather than the usage of datediff.

Examine your query that retrieves the data. If the query is selecting from a table, see what is in the table in the column that is being selected. If it is not, see how StatusDate is being computed.
Go to Top of Page

tech2
Starting Member

37 Posts

Posted - 03/30/2013 :  10:38:54  Show Profile  Reply with Quote
Yes, that's correct, the query result set is not bringing back the correct dates from the datasource. It's a simple select query that includes the 'StatusDate' field, with different dates, no computing is being executed. Does the field have to go through a date conversion like the example below? I tried this, but it didn't work.

CONVERT(VARCHAR(10), STATUSDATE, 101) as STATUSDATE

Thanks,

quote:
Originally posted by James K

that sounds like the issue is more with the query used to populate the dataset rather than the usage of datediff.

Examine your query that retrieves the data. If the query is selecting from a table, see what is in the table in the column that is being selected. If it is not, see how StatusDate is being computed.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 03/30/2013 :  13:07:02  Show Profile  Reply with Quote
nope. No need of conversion if its a straight pull. Perhaps you could post query part which retrieves the date for us to see what issue is.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000