Solved

Group by 7 day increments

Posted on 2012-03-27
3
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dates formatted Differently on another pc 2 38
Password_rules_securitty.. 12 46
Oracle performance tuning 2 55
Oracle Date add 9 33
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

734 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