Running total by date (1 Viewer)

Jonny45wakey

Member
Local time
Today, 08:05
Joined
May 4, 2020
Messages
40
Hi All

I'm hoping someone with a better brain than mine can help me out please?

I have a query called qryESH which has the following fields:-

[Job_No] - Job Number
[OpStart] - Operations start DTG
[OpStop] - Operations stop DTG
[SumOfActHrs] - Total Hrs between [OpStart] & [OpStop]
[TransDate] - Date of Transaction

1688734343431.png


What i would like is a query which sums the total [SumOfActHrs] field against all [TransDate] which are on same day.

For example:-

In [TransDate] on 20/04/2023 the query shows one row with total [SumOfActHrs] for each job, within the [TransDate] field i would then set query criteria to [Enter Date] to return something like below.

Here all [SumOfActHrs] have been totalled up for each [Job-No] by the [TransDate] value entered in [Enter Date] criteria of [TransDate] field.

1688734375718.png


Hope this makes sense?

Any help much appreciated

Thanks

Jonny
 

ebs17

Well-known member
Local time
Today, 09:05
Joined
Feb 7, 2020
Messages
1,946
SQL:
SELECT 
   Job_No, 
   TransDate, 
   SUM(SumOfActHrs) AS XSum 
FROM 
   tblData AS T 
GROUP BY 
   Job_No, 
   TransDate
 

June7

AWF VIP
Local time
Yesterday, 23:05
Joined
Mar 9, 2014
Messages
5,471
Do you really want "running total"? In Access, running total query requires subquery. Alternatively, build a report using Sorting & Grouping features and use RunningSum property of textbox.

Or do you just want aggregation by Job_No and TransDate?
 

Jonny45wakey

Member
Local time
Today, 08:05
Joined
May 4, 2020
Messages
40
Do you really want "running total"? In Access, running total query requires subquery. Alternatively, build a report using Sorting & Grouping features and use RunningSum property of textbox.

Or do you just want aggregation by Job_No and TransDate?
Exactly June7, aggregation of SumOfActHrs by Job_No and TransDate

Thanks

Jonny
 

GaP42

Active member
Local time
Today, 17:05
Joined
Apr 27, 2020
Messages
338
Then as Ebs suggested, based on your query
SELECT tblJobs.Job_No, tblJobs.TransDt, Sum(DateDiff("h",[opstartdt],[openddt])) AS Hr
FROM tblJobs
GROUP BY tblJobs.Job_No, tblJobs.TransDt
ORDER BY tblJobs.TransDt;
 

Users who are viewing this thread

Top Bottom