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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping by 24 hour time periods from 8:00:00 - 7:59:59 1

Status
Not open for further replies.

LZido

Technical User
Aug 24, 2006
21
US
I am trying to group data by 24 hour time periods. For instance the first time period is from 1/1/2014 8:00:00 to 1/2/2014 7:59:59, the second 1/2/2014 8:00:00 to 1/3/2014 7:59:59, the third 1/3/2014 8:00:00 to 1/4/2014 7:59:59, etc.

I could set up groups by a specified order, but that would require specific date ranges and a lot of work.

The report should run by parameters in 24 hour increments starting at 8:00 am on a particular day through another date.

Any ideas?

I appreciate any help.
 
IF HOUR({TIME FIELD}) < 8
THEN TOTEXT(({DATE FIELD}-1),"yyyyMMdd")
ELSE TOTEXT({DATE FIELD},"yyyyMMdd")

Use that formula to group by.
 
I am receiving an error: The results of selection formula must be a Boolean.
 
This does not go in your select formula.

The formula above it what you would use for grouping.

If you want to select by 24 hour periods, then the formula gets changed slightly:
@day24
IF HOUR({TIME FIELD}) < 8
THEN {DATE FIELD}-1)
ELSE {DATE FIELD}

Then you can put in your select formula:

{@day24} in {?Date Range}
 
I think I am having problems because my data field is a date/time field. I do not have separate fields for date and time. Do I need to adjust the formula because of this?
 
@day24
IF HOUR({DATETIME FIELD}) < 8
THEN DATE({DATETIME FIELD})-1
ELSE DATE({DATETIME FIELD})
 
Thank you so much - It works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top