Solved

ms access query to find % of invoice amt per plant

Posted on 2015-02-13
3
178 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
  • 2
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Export  Access Query To Excell 16 46
T-SQL for SS2000 -- get position of char(13) in a long text field 11 29
data analyst 3 49
Alter an update query which rounds 7 31
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now