cancel
Showing results for 
Search instead for 
Did you mean: 

Summary Field - Convert Number of Minutes to Number of Hours

Former Member
0 Kudos

I have a summary field that contains a number of minutes, I want to convert it to number of hours. For example, if it contains 90, I want to display 1.5 Hours.

I tried to create a fomula field like the following, but it does not work. MyTable.MinutesOfPlay is the number of minutes for each play, not a sum of MyTable.MinutesOfPlay for the group. How can I get the group total and put it into the fomula. Thanks.

numberVar totalHours := {MyTable.MinutesOfPlay} / 60;

CStr(totalHours) + "Hours";

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

John,

There are a few ways to do this.

1) Create a group summary that sums the minutesofplay field. Next right click the summary field and select format options. Click the Common tab and under the display string click the formula button (X-2), and enter the following:

cstr(sum(t.minutesofplay)/60)

This should give you the hours, but if you want to summarize a grand total you would have to convert those back to double first.

2) Another way would be to create a runinning total for the group:

field to summarize = minutesofplay

type of summary = sum

evaluate = for each record

reset = on change of group

This gives the minutes. Insert it into the group footer, right click, and suppress. Now create a formula that just states:

runningtotalfield/60

Insert this into the group footer and you got the hours. This is a better approach than the first because it's a little easier to work with if you plan on doing a grandtotal or anymore calculations, since it'll remain a number instead of being converted into a string

Hope that helps,

Rob

Answers (0)