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

Date Time Field 1

Status
Not open for further replies.

JerryJay

Technical User
Jan 27, 2006
24
US
I am using Crystal 8.5 and I have a column of dates which I have formatted to appear as (12:00AM, 1:00AM etc).

How can I place these into a table which shows the Hour and the a percentage based on the number of occurences in that hour from a total number of occurences?
 
Do you mean to look at occurrences across dates for specific hours? Or do you mean to look at occurrences within specific hours within specific dates?

-LB
 
I have an occurence on 2/13/2006 8:00:00 and an occurence at /13/2006 9:00:00. The result I am looking for is 8A 50% 9A 50%. The date range will be determined by the paramenters entered.
 
I was asking whether you wanted occurrences at 8:00:00 on two different days counted against the hour 8AM, or whether you were looking within days, since it changes the approach.

Let's assume you are clustering records across days, i.e., ignoring dates. Then you would create a formula {@Hour}:

time({table.datetime})

Insert a group on this and select "Print on change of hour". You can format this to display by going to format->field->date->customize and modify the settings as needed. Then add a unique ID field that identifies a specific occurrence and right click on it and insert a count on it at the group level. For the percentage, create a formula:

count({table.id},{@Hour}) % count({table.id})

Place this in the group header and then suppress the detail section.

-LB
 
You assumed correctly.

What do you mean by?
Then add a unique ID field that identifies a specific occurrence?

I understand the part about the formula I not clear on where I need to place the Unique ID. By the way thank you for your help
 
Just add the field you are counting to the details section and then insert a count on that.

-LB
 
Lb I get an error:

The Summary/Runninbg totla field could not be created
 
Are you getting this error on the percent formula or? You have to have inserted a group on {@hour}, and also you should add a condition to indicate that it will be an hourly group:

count({table.id},{@Hour},"by hour") % count({table.id})

But I'm not sure you got the error from this formula. Please provide more information in your posts. If there is an error, you should always specify where you are receiving the error, etc.

-LB
 
LB,

I am getting the error on the percent formula. I was able to create the percent calculation for hour but when I combine it with a calculation for Day of the Week my Grouping is incorrect. I know I need to solve this with a formula and was wondering if you could point me toward some documentation.
 
Again, you are not providing enough information. What are your group fields? How are you trying to combine the percent calculation with the day of week calculation? Show what you have tried, and please explain what the results were and how they differ from what you'd like to see.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top