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!

Month to Date then Current week

Status
Not open for further replies.

djeddie

IS-IT--Management
Jun 1, 2003
38
AU
Hi All,

I have a report which is firstly grouped by monthtodate, then by a current week formula which looks like this.

datetimevar adjusted;
datetimevar date1:={iApplicationStat.Timestamp};
if dayofweek(date1)=1 then adjusted:=date1- 6
else
adjusted:=date1-dayofweek(date1)+2

Now, when i run this report tomorrow (1/11/2005) the weekly summary isnt going to show the figures for monday because of 'group one' being grouped by month, and the select expert is also set to month date.

Is there any way around this problem??

I basically want the monthly group to summarize month to date and then within that, i want the weekly group to summarise the week starting monday, which happens to include the last day of last month.

cheers

eddie
 
You won't be able to do this with groupings, since one record cannot appear in two different groups. You could instead either use running totals with an evaluation formula like:

{table.date} in monthtodate

For weektodate, you could use:

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

Or you use conditional formulas like:

if {table.date} in monthtodate then 1 //etc.

You could decide to use one group and then use the conditional formula or a running total for the other calculation.

-LB
 
You could also do it using two reports--rather, a subreport in the report header or footer, that does the other grouping.

The easiest way would be to create a copy using 'Save As' and then use the option for taking an existing report as a subreport.

(Exact procedures depend on your version of Crystal, which you didn't give.)

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanx guys. I was actually thinking of using subreports this morning on the way to work. Thanx for the input!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top