Add up values based on two SEPARATE text fields (1 Viewer)

timothy.corbin

Registered User.
Local time
Today, 11:29
Joined
Apr 24, 2019
Messages
11
I am creating a database that tracks produce thrown away in my department and produces reports based on this information. We stock over 500 items (each with its own unique name), and when thrown away they are tracked by one of eight codes.
The resulting report shows that on any given day we throw away $15 of Apple A because of reason Q5, then later the same day we again throw out ANOTHER $2 worth of Apple A for reason Q5.
What I am attempting to achieve is that when the system sees that Apple A was thrown out more than once, it will add these and display the total sum of Apple A being thrown out for Q5, rather than listing every instance that this happens.

Any help will be greatly appreciated!

Tim
 

Attachments

  • Salvage Database.zip
    1.1 MB · Views: 61

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:29
Joined
Aug 30, 2003
Messages
36,125
Play with this query:

SELECT [SAL2: SALVAGE LOG].[ITEM DESCRIPTION], [SAL2: SALVAGE LOG].[REASON FOR LOSS], Sum([SAL2: SALVAGE LOG].[AMOUNT OF LOSS]) AS [SumOfAMOUNT OF LOSS]
FROM [SAL2: SALVAGE LOG]
GROUP BY [SAL2: SALVAGE LOG].[ITEM DESCRIPTION], [SAL2: SALVAGE LOG].[REASON FOR LOSS];
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:29
Joined
Oct 29, 2018
Messages
21,467
Hi. Not in front of a computer now but have you tried using a Totals query?

Edit: Oops, too slow...
 

isladogs

MVP / VIP
Local time
Today, 19:29
Joined
Jan 14, 2017
Messages
18,213
Agree with the suggestions already made.
In addition the two calculated fields in the Salvage Log table are unnecessary.
You should use a query to do those calculations when needed.
 

Users who are viewing this thread

Top Bottom