Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Can you graph average time of day? Post Reply Post New Topic
Page  of 2 Next >>
Author Message
wolfgang667
Newbie
Newbie


Joined: 31 Mar 2015
Location: United States
Online Status: Offline
Posts: 10
Quote wolfgang667 Replybullet Topic: Can you graph average time of day?
     Posted: 06 May 2015 at 5:53am
I have a formula that I created that calculates the average time of day for when an event occurs week over week. My customer is asking if I can show that in a line graph so they can see if the average time of day is getting later or earlier. I can select my formula (which is working) as the "Show values" option when creating the graph however it comes out as just 1 for week over week on the line chart instead of the time of day which got me to wondering if Crystal Reports is even capable of of graphing time of day. Google search only leads to things like"print time" and I haven't found any instances where someone was doing this. Might have to just graph minutes past midnight to show an upward or downward trend. Anyone come up against something like this? Thanks!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 May 2015 at 7:32am
you can set the group on value to per day and your 'time value between 0-24 hours.
IP IP Logged
wolfgang667
Newbie
Newbie


Joined: 31 Mar 2015
Location: United States
Online Status: Offline
Posts: 10
Quote wolfgang667 Replybullet Posted: 06 May 2015 at 8:06am
I currently have the group on value set per week (because they are wanting to see the trend the average time the event occurs week over week) and the time value is currently my formula which is the average time of day for each week. By default this value is coming in as "Do not summarize" when selected for the "Show value(s)" and cannot be changed. Hope that makes sense....
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 May 2015 at 9:05am
so you have a data set with a datetime field for an event.
you are are grouping on that field for the week.
you have a group average of the time field which you are trying to display in the graph?
 
How granular do they want to see this? Hour, minute, second?
IP IP Logged
wolfgang667
Newbie
Newbie


Joined: 31 Mar 2015
Location: United States
Online Status: Offline
Posts: 10
Quote wolfgang667 Replybullet Posted: 06 May 2015 at 10:05am
Yes, just down to the minute. The times are pretty consistent assuming my average time formula is correct (and I believe it is). So I would envision a graph where the left axis is 0 to 23 (to represent the hours of the day) and the bottom axis representing the weeks. In looking at the data the majority of the times would be around 14:XX with a slight variance up or down by a few minutes. The data label and trend line would be the most telling I would think due to the small variance week over week. I currently wrote it to display XX number of minutes past midnight but 894, 872 etc doesn't give them the time, although it does show the trend as I pointed out to them....
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 May 2015 at 10:15am

why not use datepart('n',datetimefield) to get the minute value of the event

set the graph to use
on change of = datetimefield set to group on the week
show value=use the above 'minutes' formula set to an average
IP IP Logged
wolfgang667
Newbie
Newbie


Joined: 31 Mar 2015
Location: United States
Online Status: Offline
Posts: 10
Quote wolfgang667 Replybullet Posted: 06 May 2015 at 10:35am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 May 2015 at 4:09am
?
IP IP Logged
wolfgang667
Newbie
Newbie


Joined: 31 Mar 2015
Location: United States
Online Status: Offline
Posts: 10
Quote wolfgang667 Replybullet Posted: 07 May 2015 at 4:20am
Sorry, don't know what happened to my last post, had everything typed up and poof, gone. I misunderstood your previous question regarding how far down they want to track this, my apologies for that. Ultimately they want to see on a graph that for week 1 the average event time was 2:39 PM, Week 2 2:42 PM Week 3 2:34 PM and so on. By using datepart it only looks at the minutes past the hour and doesn't include the hour portion thereby making it not workable, again my apologies for the misdirection. I think ultimately they are just going to graph it in Excel which I did this morning to see if it would work and it does. Seems like this should be such an easy thing but the back end graphing engine is just not designed to do it. I am going to install Crystal 2013 this morning as part of an upgrade project. Maybe that version can? Who knows... Appreciate your help and am willing to keep trying any suggestions you might have. I hate giving up on something......
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 May 2015 at 4:47am
sorry, the minutes was my mistake.
you can still do what I was suggesting by fixing the minutes formula...
get the datepart of hour *60 + datepart minutes


Edited by DBlank - 07 May 2015 at 4:48am
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum