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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Day of week issue 2

Status
Not open for further replies.

munchen

Technical User
Aug 24, 2004
306
GB
I am using crystal xi.

I have a date parameter and say i enter 02/08/07 then I want to display all sales for that week(Mon 30/07/05 - Sun 05/08/07)and not just the day (02/08/07).

How can I get the report to display the full weeks data?
 
Why not make the parameter a date range parameter and make the user pick the starting and ending dates?

This provides a lot more flexibility, they could run the report for any time frame this way.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
dgillz

thanks for your reply.

It has to be one date i'm afraid. Is there a way to do this?
 
Try
Code:
DatePart ("ww", {date1})
This should give you a number, 1 to 53. You can also specify firstDayOfWeek or even firstDayOfWeek, firstWeekOfYear, if the standard answers are not what you want.

That would give you the equivalent week in several years. If that's not what you want, use Year({date})

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Madawc

Using your DatePart ("ww", {tblA.salesdate}) gives me 31 for the 02/08/07.

How do i then sum the {tblA.salestotal} field for the week 31?
 
In your record selection formula, use:

Datepart("ww",{?YourDateParameter})=Datepart("ww",{YourDateField})

Then just right click the field you want to sum, select insert, grand total.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
dgillz

that seems to work perfectly. If i wanted to expand on the selection formula and say whatever day they entered (eg 02/08/07) the report would then display this weeks sales and the previous 12 weeks also.

How do I modify the below is it like this?

Datepart("ww",{?YourDateParameter})=Datepart("ww",{YourDateField})<=13

 
Try
Code:
Datepart("ww",{?YourDateParameter}) - Datepart("ww",{YourDateField}) in [0 to 12]

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top