# Another Calculation Question

This topic is 6996 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I've got a summary field on my timesheet file to indicate total number of hours in the current lookup. I'd like to show the user how many hours they have entered for the day (based on the date field of the record, rather than "today's date"). Obviously, I could create scripts and add buttons to perform a find, but is it possible to do this with a calculation? In other words, can I write a formula that will say "summarize all records where date field matches the date field of this record"?

~Courtney

##### Share on other sites

you can make a self joined relationship between the two date fields and make you summary a calculation of

sum(relationship::date field)

##### Share on other sites

Courtney, of course Slobey didn't mean to sum the date field; easy mistake to make here.

sum(relationship::date field)

He meant: Sum(datefield relationship::HoursWorked)

Wow - would you have gotten a lot of hours worked!

LaRetta

##### Share on other sites

Thank you both! That worked beautifully (of course).

~Courtney

##### Share on other sites

can I write a formula that will say "summarize all records where date field matches the date field of this record"?

I assume by 'this record' you mean the current worker? To restrict the sum to the current RECORD, you will need to also join WorkerID to WorkID on =.

So it will be:

WorkerID = WorkerID

DateWorked = datefield

If you just use a date, you'll get a sum of ALL hours for one date regardless of the Worker. It doesn't sound like that's what you want.

##### Share on other sites

Oops! Thanks Loretta

##### Share on other sites

If you just use a date, you'll get a sum of ALL hours for one date regardless of the Worker. It doesn't sound like that's what you want.

True, but each user only has access to his/her own records, so all is well.

~Courtney

##### Share on other sites

This topic is 6996 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account