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

Weekly-Monday though Sunday 1

Status
Not open for further replies.

surad

Technical User
Mar 10, 2003
37
US
How do I formulate weekly report starting Monday through Sunday?.
 
Your question doesn't provide enough detail to fully understand what you are trying to do.

As a general guess, you may want to use the DataPart()
function with a "ww" argument and the optional "firstDayOfWeek" argument.

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,

I am working on reports that need to be run daily, weekly and Monthly. Preveously they were written in MS Access (I am not sure if there is a way directly conver into Crystall since I am fairly new using Crystal). So I am trying to display activities records for the last seven days, starting Monday and ending Sunday as a weekly reports.

Please let me know best possible way.

Thanks,
Yuri
 
There is only one utility I'm aware of that converts Access reports to Crystal reports:

Assuming you are trying to get the weekly report to automatically recognize today's date and run the report for the last full week, you can use a condition such as:
--------------------------------------------------------
DatePart("ww", {your_date_field}, crMonday) + 1 = DatePart("ww", currentdate, crMonday)
--------------------------------------------------------

Just be sure to enhance it with the logic needed to deal with cases where today's data is in the 1st week of the year.

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Here is the formula that calculates a Monday to Sunday week. Create the formula then group on it with your "section will be printed" set to Day if you want to do a weekly grouping.

datevar adjusted;
datevar date1:={your.date.field};
if dayofweek(date1)=1 then adjusted:=date1- 6
else
adjusted:=date1-dayofweek(date1)+2

If you want to only see data for the current week (Monday to Current day) your select expert would be:
{your.date.field} in (currentdate - dayofweek(currentdate)+2) to (currentdate)


If you want to see last week's data from Monday to Sunday your select expert would be:
{your.date.field} in (currentdate - dayofweek(currentdate)-5) to (currentdate - dayofweek(currentdate))


IF you want this months data:
datediff("M",{your.date.field} ,currentdate)=0

If you want one month back :
datediff("MM",{your.date.field} ,currentdate)=1

If you want last month and this month:
datediff(&quot;M&quot;,{your.date.field} ,currentdate)<=1

If you want 3,2, and 1, but not this month's
datediff(&quot;M&quot;,{your.date.field} ,currentdate) in 1 to 3 Mike
 
Hi

found this posting when searching for current week related issues. My problem is how do I report on the whole of the current week. Management would like to see the capacity for the current week, so on Monday the weeks capacity might be at 90%, by tue it might drop to 80%, by wed shoot up to 99%, etc. So although the one formula shows how to report on current week (monday to current day), how do I change this formula to show monday to sun of current week only?

Eo

Etienne Oosthuysen
Hertfordshire, England
 
To reference the entire current week, you can use:

{table.date} in currentdate - dayofweek(currentdate,crMonday)+1 to currentdate - dayofweek(currentdate,crMonday)+7

-LB
 
Work great thanks

Etienne Oosthuysen
Hertfordshire, England
 
I need to do something similar (I think). From a single date from a parameter (which runs daily stats) I need to calculate the beginning of the week (a Monday), the beginning of the month, the beginning of the fiscal quarter (July through Sept., Oct. through Dec., etc) and the beginning of the year so that I can report cummulative stats for those time periods (beginnings to my entered date). Can someone point me in the right direction (with a few basic examples) please??
 
Take a look at DatePart and DateAdd functions, maybe write a test report to work out exactly what they do. You can do a formula field to get year as a datepart, and then use another formula field to pick up the start of year:
Date (@Yearpart, 1, 1)

If you need any more advice, please start a new thread, since it is a different topic. Also try a search, you may find the exact code already laid out somewhere.

It helps to give your Crystal version, since newer versions have extra options, and some extra problems. I use Crystal 8.5

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I am trying to get a report based on the dates that I will send as parameter. I can select any date range lets say sdt_dateentered = '08/01/04' and sdt_dateend = '09/03/04'.So when I enter this date the report should be in formatt of multiple weeks(for each week from Aug to Sept.), and each week seperatly marked.
Now if I enter only sdt_dateentered = '10/04/04' and sdt_dateend = '10/08/04', the report should have data for one week, marked with that week only.
I have my report but I can't make it show data as a week or each week.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top