Solved

Group by 7 day increments

Posted on 2012-03-27
3
490 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

744 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

12 Experts available now in Live!

Get 1:1 Help Now