Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Expert - Date in the period Last 12 Months 2

Status
Not open for further replies.

JCook23

Technical User
May 19, 2004
39
US
I need to have a date always be in the period of the last full year. If I run it on 9/30/04 it includes all ship dates since 10/1/03. I did not see this in the list of periods within the Select Expert. Help needed please....

CR 10.0
SqlServer

Jeff C.
 
The Select Expert is a wizard, use the manual means:

Report->Edit Selection Formula->Record:

{table.date} >= dateadd("y",-1,currentdate-1)
and
{table.date} <= currentdate-1

Note that you may find differences in the menus in my example and in your version of Crystal, this is because you omitted basic information, such as your version of Crystal.

-k
 
k,

This only gives me the last two days. Is there something I am missing?

Thanks for all your help....

Jeff C.
 
k,

Would rearranging your formula as

{table.date} in dateadd("y",-1,currentdate-1) to
currentdate-1

have any affect on performance?

Unfortunately, I can't test against my own data. Dates are stored as numbers.



Mike
 
Well performance is an entirely different issue.

Sorry, I always forget:

{table.date} >= dateadd("yyyy",-1,currentdate-1)
and
{table.date} <= currentdate-1

Need the 4 Y's for year.

-k
 
This should work.

{table.date} >= dateadd("yyyy",-1,currentdate-1)
and
{table.date} <= currentdate-1



Mike
 
Read my FAQ for optimizing the SQL (check Database->Show SQL Query, it should reflect the dates for optimal performance):

faq767-3825

You'd use 2 date formulas and reference them in the record selection formula.

-k
 
Thanks so much for your help.....I truly appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top