Solved

ms access query to find % of invoice amt per plant

Posted on 2015-02-13
3
185 Views
Last Modified: 2015-02-13
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
Comment
Question by:johnmadigan
[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
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
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

by:Rey Obrero (Capricorn1)
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

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question