Weighted Average Calc

May 17, 2007

Hi,

I've searched hours on the forum but with no luck. If there's anyone out there who can help me would be very much appreciated.

The calculation in Excel is very simple but I am unable to replicate in Access. Please don't confuse this with FIFO calculation as it is purely Weighted Average Cost method based on Buy unit prices i.e Sale unit prices are not required as it will sell at the Average Cost of the Buys upto the point of Sale.

i.e.
Buy 100 @2 = 200
Buy 100 @3 = 300
Total 200@ 2.50 =500
Sell 100 leftover will be
Total 100 @ 2.50

I am attaching an Excel S/sheet which shows the Calculation of Stock ABC and the Average Prices (which is what I am trying to achieve). I have also attached an Access Dbase with same details but without any calcs as whatever I have done I am unable to achieve my result.

Any help will be much appreciated.

Thanks

View Replies


ADVERTISEMENT

Reports :: Can't Average Blocks Of Weighted Grades In Report

Aug 7, 2013

I'm having a problem getting a report textbox to display the average value that I want.

Background:I have a DB that tracks student grades. The course is organized into blocks, with several tests in each block. Students can take the same test multiple times, in cases of failure, or if they get rolled back in class. The DB tracks whether or not each test is a retest or audit.

The tests are also weighted. For example, the Geo Quiz could be worth 10% of the grade for a block, and the final exam 90%.

Goal:My report needs to display the class number, student name, block, test, and associated scores; it needs to show the total grade for each block; and it needs to display the student's average grade across all blocks. I need to be able to generate the report at any point in the course, not just after all blocks and tests have been completed.

Setup:Since I want to display the assigned grade, but calculate the weighted grade into the block grade, I set up a query (qryWeightedGrades) to calculate the weighted grade for each test (e.g. Score of 98%, weighted at 10% of block, results in a 9.8 for the weighted grade). When it comes to calculating the block grade, I just sum the weighted scores.

In the report (based on qryWeightedGrades) I have the grouping levels set up for Class#, Student name, then Block; the test name, score, weight, retake info, audit info, etc. appears together on a row.

How to do, get the average of all the block grades. I can't get the textbox in the Student Name group level footer to average the Block grades in the Block group level footer, without getting an error. I've thought of creating another query that averages the block grades for each student, but how to incorporate that into the footer of the Student Name group level.

Here's an example of what I want the report to look like:

Class#: 13010
Student Name: Smith, Peter
Block: WF101 (4 tests in block)
....Test: Quiz1, Score: 95, Weight: 10
....Test: Quiz2, Score: 90, Weight: 10
....Test: Essay, Score: 80, Weight: 40
....Test: Final Exam, Score: 85, Weight: 40
Block Grade: 85

[code].....

Student's average grade: 91.93 <--Getting this # is giving me problems

Class average grade: ##.##

View 2 Replies View Related

Weighted Averages In A Query

Aug 12, 2005

I have developed the following query to summarise a blast design at a mine site.

Pattern Depth m Subdrill Burden Spacing BCM/hole #Holes BCM
1.00 7.00 1.00 3.00 3.00 54 10 540
1.00 7.00 1.00 3.50 3.00 63 10 630
2.00 7.00 1.00 3.50 3.00 63 10 630
2.00 7.00 1.00 4.00 3.00 72 10 720

Now there will be many patterns, the above however only contains one (called 1). Now what i need is the average Depth, Subdrill, Burden, Spacing, bcm/h. In MS Excel I would have following:

Average BCM per hole = Sum of BCM / Sum of Holes

How to do this in Access? Then just to make it more difficult I want to have the average BCM for each different pattern.

View 1 Replies View Related

Weighted Averages In Sub-query...

Sep 18, 2007

Hi there,

once again I have a problem for which I am looking for some hints...

I still have one table, called tblTransactions, which contains security market transactions. For each buy and sell order, respectively it contains one data set with columns Date, Ticker (i.e. the unique identifier of each security), Quantity (positive for buy, negative for sell orders) and Price (at which the trade was executed).

The following code gives me all stocks, which are no longer part of the portfolio since they have been sold out completely for any arbitrarily chosen date (here 1/30/07) together with the date, on which the last position in a certain stock (identified by the ticker) were sold:


SELECT T.Ticker, max(T.Date) AS SellDate
FROM tblTransactions AS T
WHERE T.Date<=#1/30/2007#
GROUP BY T.Ticker
HAVING sum(T.Qty) =0
ORDER BY T.Ticker;


Now it becomes complicated: What I am looking for is a sub-query, which I want to add to the code above and which gives me the weighted average price at which the stocks were bought and sold, respectively if there have been more than one buy or sell transaction.

That is, for the following sample data of tblTransactions...

Date --- Ticker --- Quantity --- Price
01/01/07 --- AAA --- 50 --- $50
01/01/07 --- BBB --- 25 --- $75
01/10/07 --- BBB --- 75 --- $100
01/15/07 --- AAA --- 30 --- $60
01/20/07 --- BBB --- -100 --- $100
01/25/07 --- AAA --- -40 --- $120
01/26/07 --- AAA --- -40 --- $100

...the query I am looking for should give the following result as per 01/30/07:

Ticker --- SellDate --- WeightedAvgEntry --- WeightedAvgExit
AAA --- 01/26/07 --- $53.75 1) --- $110.00 3)
BBB --- 01/20/07 --- $93.75 2) --- $100.00

Notes / how to calculate the weighted averages:
1) (50*$50 + 30*$60) / 80 = $53.75
2) (25*$75 + 75*$100) / 100 = $93.75
3) (40*$120 + 40*$100) / 80 = $110.00

I do not have any clue at all how to solve that problem. I would be very happy for any hint that could lead to the right direction.

Best regards
JapanFreak

View 5 Replies View Related

Work With Calc.exe

Nov 19, 2005

Dear all,

How do i insert or place the ms calc.exe in specific place on the form

I know how to activate with command button, but how to specifically place that application say calc.exe on the fixed specific place on the form

Thanks

View 2 Replies View Related

Dsum Need 2 Fields In Calc

Jun 11, 2006

I have a Qry field:

TotalUsage: Val((Round(Nz([UomUsage])/DSum("Nz([UomUsage])","[tblDetail]",),4)*100))

the problem is that the DSUM needs to sum up all the like records using the same SubID. I need some extra code in the divisor part. EG

subID uomUsage TotalUsage
33 10 100
33 40 100
33 50 100

34 43 100
34 57 100

the dsum needs to use SubID in order to sum correcly EG on SubID 33 as 100 uomUsage.
SubID is a Number field, Long integer.


I am presently getting wrong info. the formula above Dsum is summing as 200 since i eroneously don't have Subid in the Qry calc.

How can i fix? Thanks

Penwood

View 1 Replies View Related

Calc'd Field Won't Format?

Aug 11, 2006

I have a calc'd percentage field in my query. This is a multi user app and the problem is that is can (and does often) happen that the numerator information for my calc gets entered before the denominator data and therefore the calc'd field shows and as an error.

I attempted to use a simple IIF statement to input a message rater than the error code but now the field will not format to Percent. It worked, I got the message to display and it calc'd the records that had data, it just will not display in percent format. It does let me set the format to percent, it just doesn't display and does not allow the decimal places to be set.

This was the line:
CalcPercent:[Numerator]/[Denominator]

This is the new line:
NewCalcPercent:IIf([Denominator] = 0, "Message", [Numerator]/[ Denominator])

I've tried to search for an answer and I'm sure it is going to be something simple that I've overlooked.

Any thoughts?:confused:

View 3 Replies View Related

Field Calc No Result

Feb 4, 2008

Ok, I know it's simple but...

subtracting field B from field A.
Field A has data in all records, field B only some. The 'only some' I get a result but the ones that have nothing in B I get nothing even though A has data.
Both are currency and default is 0.
How do I take nothing from something and get nothing you ask ?

View 6 Replies View Related

Payment Calc In Table

Oct 29, 2004

This is the second edited section:
I got the update query to work properly. Is this the best way to solve my problem?

This is the original edited section:
For the problem below would it be possible to use an update query to update the table?
Criteria for the termination_date field would be "is not null"
payment_to_date Update to: field would equal DateDiff("m",[payment_start_date],Now())*[monthly_payment]
Is it possible to use other fields in the table as part of the UpdateTo: calculation? I get an error when I try this.

This is the original question:
I have a field in a table called payment_to_date that I want to always be populated with the current total of how much a customer has paid to date based on their monthly payment rate. I have a form for data entry into this table but once their account info is entered the first time their won't be any changes to the account unless they terminate the service so calculating from an event procedure on the form doesn't make sense to me (I am new at this).

I entered the following in a text box control source on the form and it works but the textbox is not bound to the table so it's not the right way to do it.

=IIf([termination_date] Is Null,(DateDiff("m",[payment_start_date],Now())*[txtpayment]),(DateDiff("m",[payment_start_date],[termination_date])*[txtpayment]))

The calculation from above is basically:
If there is no termination date then the payment to date = the number of months between todays date and the date payment was started multiplied by the monthly pay rate.

Can anyone tell me how to keep the information in the table current for the payment_to_date field?

Any help is appreciated.

Troy

View 2 Replies View Related

Making A Calc Based On A Table

Mar 7, 2006

Hello everyone. I am very new to databases, may have bitten off more than I can chew, but I was tried of working in 4 different spreadsheets and decided to pull them all into a database so that I could get what I wanted when I wanted. Here is what I need to be able to do: In a table I have 3 different industries entered 5 different times. They all cover a Monday to a Friday. Each day for each industry I record a reading from a meter. I make a calculation by subtracting Mondays number from Tuesadays, Tuesday from Wednesday, Wednesday from Thursday and Thursday from Friday. This calculation gives me how much water each industry used each day, over 24 hours. Doing this in a spreadsheet was simple. My table has the Industry name, date, previous day meter reading, present day reading. I want to have the calc show in my query. How do I set up this calculation. Any help would be greatly appreciated. Thank you. I attached a sample database that contains the table and query.:confused:

View 3 Replies View Related

Crosstab And Calc Time Difference

Jun 7, 2007

Hello again everyone!

My head's swimming right now so the solution to this problem may be right under my nose and I'm just blind to it.

I have a table with events, represented by an ID number, and the date/time the events occured. Each event is also attatched to a particular mission number. Looks kinda like this:

Mission EventID Time

Each Mission has different events like liftoff and patient contact, and I need to find the time between events for each mission. I'm trying to calculate the Time from inital call to mission end, from dispatch to liftoff, ect.

Do I need to put these times into my mission table as columns, Time1, Time2, Time3... or can I leave them normalized and still run calculations on them? :confused:

View 1 Replies View Related

What About This Average?...Field Average...

Feb 16, 2007

Hi guys!!!!

I try to find an answer in the forum about "Average Fields",but ican't
I am confused:(

I wan't to export Avg Of the fields like in the panel below:

View 2 Replies View Related

Flexi Time Query, Can't Get The Last Calc To Work

Apr 4, 2008

Hi

I'm trying to finish a query that calculates the time worked in the AM and PM, adds them together, then takes that away from the standard working day.

I've done everything else, but when I take the hours worked away from the standard day it always ends up with a positive number, regardless if they haven't worked enough hours.

I've looked through the forums and everyone is talking modules, but thats over my head.

Thanks for looking, apprieciate the help.

Alan

View 1 Replies View Related

Accessing Related Tables In Calc Fields

Apr 23, 2014

How do I use fields in related tables to create a calc field? The wizard only shows me the current table's fields. Can I do create me desired field by manually creating the calculation and bypassing the wizard? Or is this another restriction of Access?

View 1 Replies View Related

Calc Field That Waits For Input If One Or More Conditions Are Met

Sep 12, 2015

I want to create a calculated field that If the employment type is FT Hourly or PT Hourly it will have a pop up screen for the Hourly Wage to be entered. If those criterion are not met it nulls the Hourly Wage field.

View 1 Replies View Related

Any Reason Why A Calc'ed Control Doesn't Actually Have An "update" Event?

Jun 23, 2006

If I put a calculated control on my form, I don't seem to have any way of pushing its changes to a field when those changes happen. Access can be downright infuriating at times. I've spent days just putting together a simple invoicing application.

My form is not based on a query like the northwind database, because that created such ridiculous and useless behavior with subforms that I couldn't. So now that it is based on a good old fashioned table, when I change a qty or price, the calculated "extended price" (=[qty]*[price]) field visibly changes just fine, but it never has an "after update" or "after change" event. Why would this be? How am I to save these bloody changes to an actual field in a table without using some grossly inelegant code?

View 6 Replies View Related

Selecting A Date Range For A Calc'd Date

Jan 13, 2008

I Have a table that I collect data for numerous ID's. One ID may have 5 dates that is was serviced. It is due to be serviced at set intervals which is calculated from the most recent service date. I'm calculating the next service date in a text box with the DateAdd func. =(DateAdd('m',[Cal Freq],[MaxCalDate])) with the MaxCalDate being a Max func in a different text box for selecting the most recent sevice date. I'm trying to update the [Next Due] field in the [Master Asset] table with the calculated next service date so I can do queries on items that are due service within a date range. If I do an Nex Due Expr1: in the queries to calc the next due service date then do a criteria on that Expr1: such as >=[Start Date] And <=[End Date] it states datatype mismatch? Is there a way to select a requested data range on a calculated type date/time? Or How can I update the [Next Due] filed in a different table?

View 8 Replies View Related

Average

Jan 11, 2008

I have a query that finds an average. How can I get the average to only show two numbers after the decimal?

View 4 Replies View Related

Average

Dec 10, 2005

I apologise for my ignorance, but I’m very new to Access.

I have a database of dates, that I need to analyse.

I have created a Form called "DateRange" with 2 date fields;
Text1 = Date From
Text2 = Date to
Command1 = Preview Report

My Query has 2 fields;
Slotdate = all the dates (show as 20051210)
Actdur = Actual Duration (show as numbers 1 or 12 or -3 etc)

The SQL View is;
SELECT slotapp.slotdate, slotapp.actdur
FROM slotapp
WHERE (((slotapp.slotdate) Between [Forms]![DateRange]![Text1] And [Forms]![DateRange]![Text2]));


I just want to calculate an average of Actual Duration
So that my report displays the average duration between the date ranges.

Any assistance in this matter would be greatly appreciated

View 1 Replies View Related

Best 5 Day Average

Oct 2, 2007

I've looked thru a lot of posts, but can't seem to find the solution. It seems like this should be something I could figure out, but so far have not.

I have a table that is showing a production number for each day. What I'm trying to show is the best 5 day average production over a period of time.

Thanks,
Tom

View 4 Replies View Related

Age And Average

Feb 18, 2005

Could someone please tell me how to work out the age of someone using a query or report and the average age of everyone?? I also need to know how to put on a report the total number of people satisfying the search criteria. It also says i must obtain a single record for each person and to do this i need to change a query property to allow only unique records to be displayed? do u know what this property is??
Please help!!
Thank You

View 6 Replies View Related

Calc User Totals Table 1 And Enter In User Records In Table 2

Oct 28, 2004

I have two tables. The first contains details of a budget holders money allocation for a given period, and the other tracks their spend on products over that period. How can I generate a query to calculate the total running spend for each user from the "budget spend table" that will be written into the users record in the "budget allocation table".

My aim is to show details of budget allocation, total spend to date and remaining budget for each user in an Order form / report.

Can anyone please advise me on how to do this or suggest another way of doing it. Any help would be greatly appreciated.

Thanks in advance.

Regards Peter

View 5 Replies View Related

Rolling Average

Sep 15, 2005

Is there any way i can calculate a rolling average for a field in a record, based on the 10 previous records?

Cheers,
Ben

View 3 Replies View Related

Finding An Average

Aug 8, 2007

I have a customer concerns database that contains the dates for when the concerns were reported and tyhe dates for when the concerns were resolved. I am trying to make a query that finds the average of how long it takes for the concerns to be resolved. How can I do this?

View 1 Replies View Related

10-min Average Query

May 3, 2006

Hi,

I'm trying to create a query that returns 10-min average wind speed.

I have the logging date,time and the wind speed per second in the wind log table.
Date and Time Wind Speed(mph)
28/04/2006 2:17:01 PM 10.5
28/04/2006 2:17:02 PM 10.6
28/04/2006 2:17:03 PM 10
...

And I would like something like this from the query:
Date and Time Wind Speed Ave
28/04/2006 2:17:00 PM 10
28/04/2006 2:18:00 PM 7
28/04/2006 2:19:00 PM 5
......

Thx,
1.8T

View 5 Replies View Related

Average Time Per Day

May 21, 2007

i have a date field with time and date each record is entered. results look like this

Date_Complete
4/9/2007 8:26:11 AM
4/9/2007 8:31:25 AM
4/9/2007 8:34:14 AM
4/9/2007 8:34:21 AM
4/9/2007 8:34:29 AM
4/9/2007 8:34:36 AM
4/9/2007 8:34:49 AM
4/9/2007 8:41:27 AM
4/9/2007 8:41:49 AM
4/9/2007 8:42:32 AM
4/9/2007 8:42:39 AM
4/9/2007 8:42:49 AM
4/9/2007 8:43:36 AM
4/9/2007 8:44:21 AM
4/9/2007 8:45:48 AM


I want a query or report to give me the average entry time per record. Something like: Average time between orders 1:25 (one minute twenty five seconds)

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved