Solved

# ms access query to find % of invoice amt per plant

Posted on 2015-02-13
190 Views
I have a table that has the following columns:
invoice      Plant    Case_Inv_Amt     Tot_Inv_amt
3115          02               100                   500
3115          02                100                   500
3115          02                 100                 500
3115          05                 100                 500
3115          05                 100                 500
4225          02                  50                   200
4225          05                  50                  200
4225          05                  50                  200
4225          05                  50                  200
etc...............

I need to determine how much of the invoice amount is by plant - so I am looking for the following result:

invoice      Plant           Amt_Per_Plant      Tot_Inv_amt
3115          02                300                           500
3115          05                200                           500
4225          02                50                             200
4225          05                150                           200

Or I could use it in this format:

invoice      Amt_02          Amt_05                   Tot_Inv_amt
3115          300                200                           500
4225          50                  150                           200

I am thinking I need to do a few queries - I need to determine the weighted average for each plant -

Any suggestions

Thanks,
0
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 500 total points
ID: 40609178
create a query like this

select invoice, Plant, Sum(Case_Inv_Amt) as Amt_Per_Plant, Tot_Inv_amt
from Tablex
group by invoice, Plant, Tot_Inv_amt

this should give you

invoice      Plant           Amt_Per_Plant      Tot_Inv_amt
3115          02                300                           500
3115          05                200                           500
4225          02                50                             200
4225          05                150                           200
0

LVL 120

Expert Comment

ID: 40609196
if you are looking for the percentage
use this query

select  T.invoice, T.plant,T.Amt_Per_Plant,T.Tot_Inv_amt,  Format([Amt_Per_Plant ]/[Tot_Inv_amt],"Percent") as Percentage
From
(
SELECT Table1.invoice, Table1.plant, Sum(Table1.Case_Inv_Amt) AS Amt_Per_Plant, Table1.Tot_Inv_amt
FROM Table1
GROUP BY Table1.invoice, Table1.plant, Table1.Tot_Inv_amt
) As T
0

Author Closing Comment

ID: 40609217
Great - thanks so much for your help.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
###### Suggested Courses
Course of the Month7 days, 20 hours left to enroll