Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Totals in Query

Status
Not open for further replies.

jenniejadin

Technical User
Apr 3, 2008
1
When working with the data pulled for the SumOfAmount, which is the Amount from the Table TblServiceVisits, my relationship is off somehow.

TblVisitCharges ID 1035 has a charge of $102.00,
TblInvoiceParts InvoiceID 339 has a charge "Freight Charges" for $5.20, a charge "Door Handles" for $5.52, a charge "Timer Knob" for $2.89, and a Charge for "Choke Cover" for $.62

Each data line returns Auth#, where there can be some, one or none VisitInvoice ID's and there can be some, one or none PartsInvoice ID's. Each VisitInvoice and Each PartsInvoice is independent of each other but must be tied and totaled in relationship to the Auth#.

In my example with ID#1035 and one of each of the part charges on InvoiceID#339 after pulling the data into excel, I created a pivot table on the TblVisitCharges ID's and receive a total back of $408.00, which is 4 X's the rate, because it is pulling the VisitInvoice total each there is a PartsInvoice ChargeID.

Do you see this problem? What can I do to keep the total from multiplying?

I also have a problem with the InvoiceID charge amounts....when I do anything with $ values, the digits are correct but they are all moved to the left a decimal point. What should appear as $39.74, shows up as $397.40

Can anyone guess what might be the problem?

 
it's a whole lot easier to understand complex calculations/criteria when you display your data and expected results instead of trying to explain the complexity. A picture is worth a thousand words, right?

[tt]
tblVisitCharges
ID Charges Auth#
data data data


tblInvoiceParts
InvoiceID FreightCharges Auth# ?Other fields?
data data data data

[/tt]
explain any relationships (one to many on Auth#? which one is the many?
and show your desired results:
[tt]
fieldnames
data
[/tt]
and explain any calculations using the sample data you showed above.
[tt]
You take all the amounts from {these fields} and add them all up because they have the same auth#[/tt] - or whatever the formula is for determining what to do with the numbers.

Additionally, it helps if you post the SQL of the query that is causing the problem.

Leslie

In an open world there's no need for windows and gates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top