Queries :: Average Price Of Last 5 Line By Items By Recent Date
Mar 4, 2015
Any way to filter the average price of of a Product within the last 5 occurences (Line Items). It would pull a week back so WHERE: Between Now()-7 and Now(). Example:
I need to get an average repair price of multiple part numbers with the same root number i.e.
8 each 8TJ124GGN1 4 each 8TJ124GGM1 7 each 8TJ124GGP1
First I used a query to average the repair price of each subset of numbers, and then queried the query to average all the subset prices together.
If I simply use the AVG function in the first query, I can use it again in the second query to get the average price of all the subset price averages. HOWEVER, if I use the expression:
…to get a more accurate average by throwing out the high and low values, I get a:
“…expression too complicated to be evaluated”
when I try to average the averages in the second query using the AVG function.
I don’t know why the expression is “too complicated” since the first query has already completed its computations before the second query begins its AVG function.
I must admit I am a "newby" to Access but I have bought my Access 2000 bible, as I am running Access 2000, and attempted to create my desired database. I have linked to 2 tables that I download on a daily basis. This is my inventory from two different suppliers. I then have created two queries that filters each of these files to only show positive quantity items, filters out item specifics, etc.What I want to do is join the 2 queries with their data already filtered. Both of the files from 2 different suppliers contain some of the same data. Once joined if there is an item that is the same I want to delete the higher cost item and only show the lower cost item, I also want to show the rest of the items that do not match. It is easy to identify the same items as every item contains a 12 digit identifier called a upc.I can create a UNION ALL query that shows every item from the two queries. However, I am unsure as to how I go about deleting the higher cost item and only showing the lower cost item if the item is the same. On a side note after I get the results desired I will then be createing an append to query and append all this information to another file that is then uploaded to another system.I will try to attach some sample data that I am using from the two queries I want to join, this data is only a sample of a much bigger file.Thank you and any and all comments or suggestions is much appreciated.
I have a main form with 3 sub forms. The main form is tied to a table called QUOTES_MASTER. The first sub form is tied to a table called QUOTE_ LINE_ ITEMS_DIRTGLUE. It calculates the subtotal when selecting items. The relationship is one-to-many linked on QUOTE_ID.
The second sub form adds up total of all line items and is not tied to a table.The third sub form adds ESTIMATED FREIGHT to the PRODUCT TOTAL and is not tied to a table. how to get the values from the line items form inserted into the QUOTE_LINE_ITEMS_DIRTGLUE table as they are added.
I also want to insert the total value from ESTIMATED DELIVERED into the LINE_TOTALS field in the table QUOTES_MASTER.I tried this code on the product total sub form but it doesn't do anything and there are no errors:
Private Sub PROD_SUB_AfterUpdate() DoCmd.RunSQL "UPDATE QUOTE_LINE_ITEMS_DIRTGLUE SET QUOTE_LINE_ITEMS_DIRTGLUE.SUBTOTAL = Me.PROD_SUB WHERE QUOTES_MASTER.QUOTE_ID = " & Me.QUOTE_ID
I have a problem here that I've been wrestling with for a while.I have a table, ID, Date, and Grade.It is set up that way, and I tried
Code: SELECT tblGrades.StudentID, tblGrade.Grade, Max(tblGrade.GradeDay) FROM tblGrades GROUP BY tbGrades.StudentID, tblGrades.Grade;
I figured since I'm grouping by both StudentID and Grade, it wont return the most recent grade from that Student. Is there any way for me to NOT group by Grade and just display the results of the Max(GradeDay?)
I have a table called Books, in that table there is 4 columns ChapterName, Auther, ITEM, Price.
Each book has a item number, and each book has a few records with the same data, just the first column is different where its the ChapterName, each book has a price, but only once, meaning in the first record of each book it will be a price in the column price
Now I want a Query where i can get which book dont have a price at all, and which book has more than once a price, how can i do that?
I atrying to make a query that shows the price for a product, based on two parameters.
Parameter one is a product code. Parameter two is a date. This date falls between two dates.
I have one list (table) where is product code and invoice date.
The second list (table) I have, contains product code, and price valid from date, and price valid to date columns. This price valid to date is often not filled, and the price I still valid as we speak. If the date is filled there is often a new entry with an updated price. But sometimes, even if there is a new entry in the table, the date 'valid to date' is sometimes also not filled.
I would like Access to show me the valid price for the specific product. What criteria should I give in the macro, in order that Access shows what I want?
For illustration purposes, a small overview of my table:
Product, invoice date, price according to price list AAAA, 02.05.2012, ???? AAAA, 01.08.2012, ???? BBBB, 10.06.2013, ???? AAAA, 31.10.2013, ???? AAAA, 16.11.2013, ????
If you happen to know how this search can be performed in Excel, I am of course also happy to read that. (But my index, or Vlookup functions, give only the first possible result in the table. As I do not know how to give in the date parameter.)
This is a toughie (i think so anyway!). I'll attempt to explain!!!
I start with a CONTINUOUS form in my DB that shows all readings for a single given customer's connections. E.g. Customer A has 5 connections and each connection has say 3 readings. Thus this query which uses joins between the Customers, Connections, and Readings tables, would return a list of all readings for each connection, so in the above example: 1*5*3 = 15 records.
Not too tricky so far, but then what I want is for each connection to have just one line showing the latest reading (easily achieved by use of SQL Aggregate Max function on the date field coming from the readings table) TOGETHER WITH the last-but-one (next most recent) reading. So back to the example taking Customer A's connection 1, the row would be as follows:
Cust Conn CurReading PrevReading A 1 750 500
Where the CurReading value (750) comes from a different record than PrevReading (500).
I've tried all sorts of ways (subqueries etc.) to achieve this without success. The main problem being that any sub query would require parameters from the current record's fields, which seems not to be possible. Can anyone help or is this simply not possible in MSAccess Forms. If it isn't possible anyone have any suggestions as to an alternative way?
Code: tblequipment equipmentid equipmentnumber (user defined ID)
tblrentals rentalid rentaldate rentaltime fromparty (c for customer, e for employee, o for other) frompartyid (foriegn key to either customer, employee or other) toparty (same as from) topartyid (same as from)
tblrentaldetails detailid rentalid equipmentid
How can I get a list of ALL equipment showing the most recent date and time, also showing the respective toparty and topartyid? I can get it fairly easily, except for including toparty and topartyid.
I work in the Insurance Industry and I am having a hard time trying to find the formula for finding the answer to the below issue I am having.
In a table I have 4 columns:
1st: Total # of Claims (Claim Count) 2nd: Total # of Items (Item Count) 3rd: Item % of Claim Count 4th: Average # of Items per Claim (This is the number which I am trying to get)
Is there a formula which could give me the "Average # of Items per Claim"?
I'm setting up some analytical reports and i'm having a hard time with some date criteria.
I've gotten monthly averages already and what i want to do is take those monthly averages, and average them throughout the year. (the year being from the specified date on a form control back one year)
Month([Forms]![Report Runner]![Date1]) and Year([Forms]![Report Runner]![Date1]) worked great for specifying a certain month in a certain year, but what i'd like is to show all the monthly numbers for every month going back one from [Forms]![ReportRunner]![Date1].
I tried this:
Code: >(Year([Forms]![Report Runner]![Date1])) And <((Year([Forms]![Report Runner]![Date1]))-1)
I have a database that prints out a contract of line items (as a report) for the home remodeling business.
I use a query to limit the line items which show the description and cost as a subreport.
The only way I could create a total of these line items was to enter an unbound text control, and put in the formula =sum([cost]) where cost being the field name. It works fine, but I need to but the result in a currency format - - two decimals and a $ sign. I sure would like it to do it at the query level, instead of at the report level (will make it more user friendly)
using Access 2000.I have a table with fields (image, info1, info2, info3).I want to produce a report where 15 records are displayed in a table like manner. each table cell contain the whole record and the table is 5 rows by 3 columns.
I have a form that could have duplicate material descriptions , is it possible to have on that form a field that counts the number of line items for that material and when the material changes the new number will appear .
I have an Orders form (frm-Orders) that includes a subform (frm-Order Details Subform). The subform has line item totals.I want to be able to sum the line item totals and show the result on the main form, but I can't get it to work. Seems like it should be an easy thing to do.
Someone suggested I try this but it didn't work:
In the footer of the subform I created this expression - =SUM([Line Item Total].
Then in the main form I created a textbox with this -- =[Forms]![frm.Orders].[Form]![frm-Order Details Subform].[Form]![txtSum].
If i simply remove the GROUP BY line and stick the semicolon at the end of the previous line (.EmpID; ) it works just fine. How is adding a group by line causing an error?I tried adding another parenthes at the beginning ((( and ending the joins as EmpID); and that failed with the exact same error.
I am building a database in Access which I would like to eventually link to my website in order to sell hotel bookings online. I believe I have set all the fields up properly but when it comes time to set the price I'm lost. Each hotel has about 3-5 different prices throughout the year depending on the date. How can I design a table(s) to accommodate this? Any help is appreciated.
I am trying to create a simple database to keep track of computer components that I order for custom PCs. The data is fairly basic Quantity, Description, Stock Code, Delivery Status, Cost, Cost+VAT, Date Delivered. The list is currently 500+ rows of data. I simply cut and paste this info directly from my online invoices.
What I want is to be able find the the last price paid for an item (often the same items have different prices week by week) Eventually I would like to be able to create a rough quote using the latest prices (plus mark up) and also view a price history.
I would also like to include a few pictures as URL links to the suppliers website ????
At present the data is in Excel and linked to a single table in Access (but this can be changed). I realise that I have to group the records somehow but cannot get it to work. At present it lists every record either in date order or product order.
The stock code should not change, but product descriptions do. So any links to pics would be based on stock codes
Someone please tell me how to display the full list of products but only the latest price/date
If you think the current format is rubbish then feel free to suggest an alternative. I much prefer Excel but have never really got to grips with Access (used to be a vba programmer with Excel). To link to pictures and hide data that customers might see Access seems the obvious choice. So I try again!!!!!
I need a (group by?) query that shows my items only by the last updated price by date.
Basically i need to show the last date. (MaxDate?)
I keep a database for my restaurant of my food items and change their price everyday. i now have a table that archives individual items by date, price and company in a subform.
I am trying to kick out an item or inventory sheet by creating this query but i cant seem to group by last date. i have all my items showing up multiple times (as many as i entered) i have been easily able to create an inventory report off a query i used with only one date that i would change. but now i want to archive prices for charts.
i have tried max dates on item_id fields and date fields and nothing seems to work.