Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Group by 7 day increments

Posted on 2012-03-27
3
Medium Priority
?
529 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 101

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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

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…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  â€¦
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

885 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