Solved

Group by 7 day increments

Posted on 2012-03-27
3
494 Views
Last Modified: 2012-08-13
GroupExample.xlsRather than grouping by a week, I need to create groups of 7-day increments.  I have a list of patients that sums the amount of treatment time received per day.  Then, I need to group these in 7-day increments (and look for how many times they met the 180 minute goal in that period).  

The starting date of the treatments is different for each patient, as is the ending date.  I have attached an example which demonstrates how I have it now (grouped by week), and how it should look (grouped by 7-day increments).  I am new to Crystal, but it seems to me that you should be able to change grouping increment, I just cannot figure out how.  

Thanks for your help.
0
Comment
Question by:dizma
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37774716
You can't really change the grouping increment however, you could change the treatment dates so the dates always start on a Monday.

You could also do this with manual grouping fairly easily

Do you have other data available to the report?

mlmcc
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 37775905
You can't change the built-in meanings but if you include a simple sql query in your data source then it should be possible to do what you want.

Assuming your current source is a table, then you need to go back into the database expert and  use the AddCommand option to include a query that gets the minimum date for each patient.

The query must be written in the sql dialect of your database but will be something like...

Select PatientID, min(yourdatefieldname) as MinDate from yourtablename Group By PatientId

You can then join this to your current table on PatientID fields, which in effect attaches the patient's min date value to every record.
This allows you to create a formula field in the report, to give the week number,  which would be..

({table.yourdatefieldname} - {command.MinDate}) \7 +1      //note \ not /

You can then group on this field (within your patient group, of course).
0
 

Author Closing Comment

by:dizma
ID: 37778401
Thank you so much.  Very clean approach and well described!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now