How To Create Aggregate Sales Grouped By Product ID

Nov 6, 2014

I have created a Query that shows

The Product ID, Product Name, Quantity, Price, Gross Margin, Sales, Profit.

The only problem is that in the two tables I was given in my assignment, there were multiple dates for the purchase, thus even though I have 74 products there is multiple listings i.e.

110-10 Sofa Chair 5x $2 profit:$10 - october 11
110-10 Sofa Chair 6x $2 profit:$12 - october 12

I need to group it so that it becomes this.

110-10 Sofa Chair 11x $2 profit:$22

The date/location is not important, only the aggregate sales. Here is my SQL ....

SELECT SALES.PRODUCT_ID, PRODUCTS.ITEM, PRODUCTS.PRICE, SALES.QUANTITY, PRODUCTS.GROSS_MARGIN, Sum([Quantity]*[Price]) AS Sales, [Quantity]*[Price]*[Gross_Margin] AS Profit, PRODUCTS.WIDTH, PRODUCTS.DEPTH
FROM PRODUCTS INNER JOIN SALES ON PRODUCTS.PRODUCT_ID = SALES.PRODUCT_ID
GROUP BY SALES.PRODUCT_ID, PRODUCTS.ITEM, PRODUCTS.PRICE, SALES.QUANTITY, PRODUCTS.GROSS_MARGIN, [Quantity]*[Price]*[Gross_Margin], PRODUCTS.WIDTH, PRODUCTS.DEPTH, SALES.TRANSDATE
HAVING (((SALES.TRANSDATE)>=#9/1/2011# And (SALES.TRANSDATE)<=#12/31/2011#))
ORDER BY Sum([Quantity]*[Price]) DESC;

Nordic_Inventory1.zip

View Replies


ADVERTISEMENT

How Can I Create A Sales Form That Can Update Both The Product And Sales Tables

Oct 11, 2007

Am creating a Product-Sales Database, and I would like the corresponding Sales made in the Sale Table to be automatically deducted or to be reflected in the Product Table. The product table contains all my stock and has a relationship with the Sales Table. The Sale Table does not necessarily include the Stock. How can I create possibly a Sales Form that will be used as an entry point for all the products (stock) sold and automatically register the sold products in the Sales Table and at the same time make the required adjustments in the Products Table.

View 1 Replies View Related

Combine Monthly Product Sales Query

Feb 27, 2008

I was wondering if there is a way to combine sales by month for a year where it would show the product then for say January and the total sales and so on for each month.

View 7 Replies View Related

Queries :: Product Per Date - Show Days With 0 Sales

Aug 11, 2014

I'm trying to build a query that adds up the total sales for a given product per date. The problem I'm running into is some products have $0 sales on a given day and don't appear in the table I'm querying. How would I get the query to add a record for that day for the given product with 0 in the sales field?

To give more details, I currently have one table showing the sales data. It has a record for every sale that includes the product of the sale, the amount, and the date. In the query, I'm summing the sales for a given day and product. Then I plan to export to Excel where I will run additional analysis.

If there are no sales for the product in a day, I'd like it to list the date and product with a $0 in the sales column.

View 5 Replies View Related

Queries :: Aggregate Sales Totals Within Specific Time-frame?

Mar 23, 2013

stuck with this problem on trying to calculate the aggregate sales totals of a product within a specific time frame. The query that I have built instead divides each sum by date, where it should be grouped according to product instead.

Here are some screen shots as to how it looks in Access. [also see attached ZIP if you don't want to unbreak links ]

[URL]

As you can see, the PRODUCT_ID column is not combining together according to their IDs.

[URL]

This how my Design View looks.

The SQL for my current query is:

SELECT PRODUCTS.PRODUCT_ID, Sum(SALES.SALES) AS SumOfSALES, SALES.TRANSDATE
FROM PRODUCTS INNER JOIN SALES ON PRODUCTS.PRODUCT_ID = SALES.PRODUCT_ID
GROUP BY PRODUCTS.PRODUCT_ID, SALES.TRANSDATE
HAVING (((SALES.TRANSDATE)>=#9/1/2008# And (SALES.TRANSDATE)<=#12/31/2008#));

View 3 Replies View Related

Tables :: Create Database For Managing Nonconforming Product Internally

Jul 25, 2014

I am attempting to create a database for managing nonconforming product internally.

Different stages will need to be assigned to an individual within the organisation, is it possible to have a lookup value in my table which draws its information from active directory?

All the users are obviously in here and managed already, I dont want to have to create and manage a separate list of users just for my database.

View 2 Replies View Related

Forms :: Create A Production Forecast Form Based On Previous Sales History?

Jul 19, 2014

I need to create a production forecast form based on previous sales history.The history is based a sales and grouped by month & year

So on the form, which needs to be a continuous form, I want products to show as rows and months as columns The sales history per month needs to be displayed as well as a field allowing to user to enter the production forecast.

I can write the sales history to a temp table.However I never know how many months history the user is going to want displayed at run time. Could be 3, 7, 12 or 15!

Attached spreadsheet shows what I am trying to achieve. Is this possible and if yes, how would I do it?

View 6 Replies View Related

Families Grouped Together

Nov 16, 2005

Hi,

I want to make a church database grouping families together and identifying each persons position in the family while still having each family member with an individual profile, i.e. birthdays, anniversaries, position, classes, memos, possibly donor info.

How do I do this?

Thanks

View 1 Replies View Related

Merging Grouped Data?

Apr 3, 2008

So i'm not sure where this post belongs as it may encompass several items.
I have an excel sheet where every row has an email address and a product purchased. I've imported it all into access but would like to run a query to find out how many people that bought x purchased y. Or tell me how many people that x did not buy a,b, or c.

Part of the problem is that each record is one product. My data looks like this:

email: Product:
e1 p2
e1 p7
e1 p33
e2 p2
e2 p9
e3 p1
e4 p1
e4 p3

I was able to group some of the data by email address in access but can't figure out a good way to query it. I'm thinking I probably need to merge the data where each unique email address is a record and the products have all the products purchased instead of just one but I really have no clue how to do that.

Is this easily do-able? how would I go about this?
Thanks alot!

View 2 Replies View Related

Grouped Counts Using Criteria

Jun 12, 2007

Ok, I'm missing something simple here I'm sure, but I can't see the wood for the trees at the moment.

background guff
What I have is a system tracking actions being undertaken. There's an SLA for these actions which means they should be completed within 10 days. At the moment we have no reporting on whether or not we're meeting this SLA.

Now obtaining the information for all the data this year is fine and dandy and works ok. Where I'm having problems is doing a monthly breakdown for the ytd.

I'm using the following query to give me my raw data:
SELECT [Parent Table].ID, [Parent Table].[Date entered into database],
[Parent Table].[Leave Date], [Parent Table].DateCompleted,
DateDiff("d",[leave date],[datecompleted]) AS DaysToCompleteFromLeaving,
DateDiff("d",[date entered into database],[Datecompleted]) AS DaysToCompleteFromEntered,
DatePart("m",[leave date]) AS [month]
FROM [Parent Table]
WHERE ((([Parent Table].[Date entered into database])>#1/1/2007#)
AND (([Parent Table].[Leave Date])>#1/1/2007#)
AND (([Parent Table].DateCompleted) Is Not Null));

Which gives me the various dates, the number of days it took to complete the record from when a person left the company ,from when their information was loaded into the database and finally a number for the month.

I have a query that happily gives me the average completion times on a monthly basis:

SELECT Avg(CInt([DaysToCompleteFromLeaving])) AS AvDaysFromLeaving,
Avg(CInt([DaysToCompleteFromEntered])) AS AVDaysFromEntered,
[Completed Leaver Dates].month
FROM [Completed Leaver Dates]
GROUP BY [Completed Leaver Dates].month;


but I seem to be having a great deal of difficulty specifying criteria on a Count to show me the same breakdown.

I can get a total count of records per month:
SELECT [Completed Leaver Dates].month,
Count([Completed Leaver Dates].DaysToCompleteFromLeaving) AS CountOfDaysToCompleteFromLeaving
FROM [Completed Leaver Dates]
GROUP BY [Completed Leaver Dates].month;


But what I want to do is split that number into two columns, records where the completion date was >10 days and records where the completion date was <= 10 days which is where I'm having some problems.

Putting a critera in design view for the count field still returns the total number of records per month and returns the following SQL query:
SELECT [Completed Leaver Dates].month, Count([Completed Leaver Dates].DaysToCompleteFromLeaving) AS CountOfDaysToCompleteFromLeaving
FROM [Completed Leaver Dates]
GROUP BY [Completed Leaver Dates].month
HAVING (((Count([Completed Leaver Dates].DaysToCompleteFromLeaving))>10));
I'm fairly sure it's in the HAVING clause, but I'm not sure what I'm missing.

View 1 Replies View Related

Help Pls! Calculated Grouped Querry

Jul 30, 2007

Hi Guys,

can anybody help me on the below?

i need to generate a query contains

name, project, total_Hours_worked (only if total is >45) for a week by each employees. the query should contain total hours for all the weeks.
The table contains week_ID column and dyas worked column.
i can create a query which gives me sum of day_hours worked using selecct sum(day_hours) as Total.

but i badly need total sum of week hours worked by each employees. so that i can generate overtime report grouped on weekly who has woked more than 45 hours per week.

the table is attached. please see and help me if you can.

Thanks
Kiran Konsaai

View 2 Replies View Related

Report Detail Grouped By Possible?

Nov 29, 2007

Hi,

I'm trying to create a report that separates info depending on Prodno. For now it lists all the right information like this

Code:Product Aisle Rack Shelf0218 7 6 20775 5 6 20775 4 4 40775 0 1 30963 1 1 71000 7 4 61000 2 3 71006 8 8 8

which is fine and dandy. What I would prefer is it do like this

Code:Product Aisle Rack Shelf0218 7 6 20775 5 6 2 4 4 4 0 1 30963 1 1 71000 7 4 6 2 3 71006 8 8 8

I am assuming it is some kind of group by in the details section? Any help would be great,

Thanks,

View 2 Replies View Related

Show Grouped Date In Chart

Jan 18, 2006

Hi!

I use MS Graph and need show 2 data types:
1. Invoice Value, EUR
2. Date
Date axis group records by month, for Example Period from 2005.01.01 And 2006.01.01 has 12 positions in Date Axis.
Her I have problem: I need show sum of Values for every month.
For example in Period from 2005.01.01 till 2005.02.01 I have 3 Values: 200, 500, 600EUR. Her I need to show 1300EUR, and so every month. Her is my strandart code:

Dim strSQL1 As String
strSQL1 = "SELECT Date As Date, Value FROM Table WHERE (Date BETWEEN 2005.01.01 And 2006.01.01)"
Me!chrStatistik.RowSource = strSQL1

Thank You in advace for help.

View 5 Replies View Related

Eliminating Duplicates In A Grouped Report

Aug 23, 2006

OK, first time posting so I'll try to be clear here. I work for a special education agency and have created a database to track student/therapist information. Now, I have reports showing which kids are in which schools and who their therapists are. What I can't figure out is how to print a report, grouped by school, that will display which therapists are active in that school.... any ideas?

View 1 Replies View Related

Queries :: Selecting Max From Grouped Data

Nov 26, 2014

I am having trouble writing what I think should be a fairly straight forward query... I am have a table with 2 fields, the first contains a list of subjects, the second contains a list of scores that students got in their tests in that subject.

So the data looks like this:

Maths 54
Maths 69
Maths 41
English 71
English 55
Art 44
Art 43
Art 66

I would like to write a query that selects only the highest score for each subject and presents it like this:

Maths 69
English 71
Art 66

View 4 Replies View Related

Reports :: Grouped Totals Report

May 8, 2013

I have a table with:

Invoice Number | Customer Name | Item | Item Cost | Invoice Date | Paid | Date Paid

Example of data:

AK001 | A Brown | Blue Car |1000 | 1/4/2013 | Yes | 20/4/2013
AK001 | A Brown | Red Car |2000 | 1/4/2013 | Yes | 20/4/2013
AK001 | A Brown | Yellow Car |500 | 1/4/2013 | Yes | 20/4/2013
AK002 | A Brown | Black Car |1000 | 7/4/2013 | Yes | 20/4/2013
AK003 | B Smith | Blue Car |1000 | 12/4/2013 | Yes | 25/4/2013

I want to create a report from this table that outputs as:

Invoice Number | Customer Name | Total Price | Invoice Date | Paid | Date Paid

Example of report from Example Data:

AK001 | A Brown |3500 | 1/4/2013 | Yes | 20/4/2013
AK002 | A Brown |1000 | 7/4/2013 | Yes | 20/4/2013
AK003 | B Smith |1000 | 12/4/2013 | Yes | 25/4/2013

Is there an easy way to do this.. or will I need to make a new linked table with the invoice number as a lookup?

View 2 Replies View Related

Assigning Grouped Attributes To A Record

Sep 30, 2011

I'm creating a database of companies. Every company has at least one field of services they provide. There are three main groups which contain all the services (Let's say I have three tables).

What I need is to have a form/table (query?) where I can assign to a company any number of services from any group. Is it possible to do it in a form where I could simply add a service by choosing a group first and then a proper service, and then add more in the same way?

View 3 Replies View Related

Generating Reports For Individual Grouped Records

Oct 19, 2006

This probably is a very stupid question but I am a new user and have been pulling my hair out for a week over this. I have created a report and linked it to my table but it generates a list of all of the values in my table on the report. What I want is a way to generate a report page for every row in my database table grouped on a key record that is unique to each data row. If anyone has any advice it will be much appreciated, thanks.

View 1 Replies View Related

Queries :: Add Columns To Grouped Max (date) Query

Mar 14, 2013

I have a database that tracks students and their test scores. I am trying to figure out a way to where it will pull the student's latest test score and compare it to see if they fall within standards. So far I have 3 tables.

tblStudents
studentID
studentName
studentEmail

tblResults
resultID
resultStudent
resultDate
resultTest
resultScore

tblTests
testID
testName
testPassScore

The query I have written looks like this: SELECT tblStudents.studentID, Max(tblResults.resultDate) FROM tblStudents LEFT JOIN tblResults ON tblStudents.studentID = tblResults.resultStudent GROUP BY tblStudents.studentID." The data pulls just fine at this point. What I'm trying to figure out is how to then add more columns to this query to start doing comparisons. When I try to add more columns it tries to use them for additional grouping and adds many more records.

View 8 Replies View Related

Queries :: Totals Query Grouped Across Columns

Mar 5, 2015

I have simple table data structured as follows;[Origin], [Code], [Weight]. The Code field is a lookup field that will contain one of 8 choices; 10, 13, 13c, 23, 25, 27, 27a, & other. The other fields are pretty much self explanatory. Sample data would look like this:

Code:
Origin Code Weight
Edison 13 4.25
Edison 13c 2.87
Piscataway 10 5.45
Middlesex 23 1.24
Edison 13 5.21

What I need to create is a totals query where I first group by origin value, then a column for each "code" value which totals the weight for that "code". A sample output would look something like this:

Code:
Origin 10 13 13c 23 25 27 27a other
Edison 9.46 2.87
Piscataway 5.45
Middlesex 1.24

The only way I can think to accomplish this is to restructure the original table to include a field for each code and enter the weight in the appropriate 'code' field. If this is the only solution then Ill have to live with it, but is there any way to create this output using my original structure?

View 1 Replies View Related

Queries :: Count Active Members Grouped By Month

May 5, 2015

I am trying to get active member count by month in MS Access.

Table looks like this:

admin ID firstName sDate eDate 1 Adam 01/01/2015 01/04/2015 2 Ben 01/02/2015 15/04/2015 3 Carl 01/02/2015 13/03/2015 4 Don 13/01/2015

Required output would be like this

2015-Jan: 2
2015-Feb: 4
2015-Mar: 3
2015-Apr: 3
2015-May:1
etc..

I got this far:
SELECT DISTINCT count(a.ID) as mCount, year(dimDate.Date) as [Year], month(dimDate.Date) as [Month]
FROM admin AS a INNER JOIN dimDate ON (dimDate.Date >= a.sDate AND dimDate.Date <= a.eDate) OR (dimDate.Date >= a.sDate AND dimDate.Date = null)
GROUP BY year(dimDate.Date), month(dimDate.Date)
ORDER BY year(dimDate.Date), month(dimDate.Date)

Query4 mCount Year Month 31 2015 1 71 2015 2 44 2015 3 13 2015 4

View 2 Replies View Related

Queries :: Grouped Query That Returns A List Of All Periods

Nov 21, 2013

I have a grouped query that returns a list of all periods qryPeriod

Code:
SELECT [tblMaster].Year, [tblMaster].Week, ([Year] & " - " & Right(0 & [Week],2)) AS Period
FROM [tblMaster]
GROUP BY [tblMaster].Year, [tblMaster].Week, ([Year] & " - " & Right(0 & [Week],2));

Year | Week | Period
2013 | 48 | 2013 - 48
2013 | 49 | 2013 - 49
2013 | 50 | 2013 - 50
2013 | 51 | 2013 - 51
2013 | 52 | 2013 - 52
2014 | 1 | 2014 - 01
2014 | 2 | 2014 - 02
2014 | 3 | 2014 - 03
2014 | 4 | 2014 - 04

[code]...

these are then used as the start of a between lookup against [tblMaster] along with the last record in the qryPeriod (2014 - 04)...I will need 4 queries so If someone can sort out last period - 8 I can probably do the others.would DLookUp do this say return the last 4 values, Last 6 Values and Last 8 Values

View 6 Replies View Related

General :: Display Headers Over Grouped Items In Table

Dec 14, 2012

I have a table of items for our companies quotes. When we go to print out our quotes to send to the customers, the salespeople would like most of the items to be grouped under certain "headers" for the systems they are part of.

Ex:

Autopilot System
Part #1 Qty 2
Part #2 Qty 1

PA/GA System
Part #4 Qty 4
Part #5 Qty 1

My 'Items' table currently has these fields:

ID (PK)
System_ID (FK for 'Systems' table)
Part_No
Qty

etc...

'Systems' table has these:

ID (PK)
Sys_Description

I have a query using a RIGHT JOIN and a GROUP BY to tie everything together, I'm just not certain how to go about displaying the information the way I did above.

View 5 Replies View Related

Queries :: Concatenate Multiple Records Grouped By Date?

May 2, 2014

I have a rates table with 3 fields : [RateDate], [CurrencyID], [FXRate]

I also have a currencies table with 2 fields : [CurrencyID], [CurrencyCode]

Where [CurrencyCode] is just the 3-character currency code (i.e. EUR, GBP, USD etc.)

The rates table uses a composite primary key across [RateDate] and [CurrencyID] - i.e., there should only be one unique record for each combination of date and currency.

Not every date will be present in the table and, within each of those dates, not every currency will be present (but at least one, obviously)

I want to write a query which will return two fields. The first field will contain all of the unique dates in the table for which the [FXRate] field (for any currency) is blank / null. Straightforward enough :

Code:
SELECT [tblRates].[RateDate]
FROM [tblRates]
INNER JOIN [tblCurrencies]

[Code]....

But this gives me a separate record for each date / currency combination in the returned dataset. I just want one record per date and all of the currency codes in a single string (separated by some delimiter) as a text field.

View 3 Replies View Related

Queries :: Calculate Percentage On Grouped And Filtered Data

Jul 20, 2015

I'm very new to Access and I'm attempting to write an expression in a query that will calculate the % of the count of "Exchange" field (Exchange is a text field and is grouped and the count based on each unique name) where the total count is based on the filter where "Group" = 'FS' or 'S'.

The below seems to work, but there is a better way of going about this (especially if I have to add more filter criteria). I added a pic of the query I'm trying to build.

PercentofTotal: (Count([Exchange])/DCount(Count([Exchange]),"[Holdings]","[Asset Group] = 'FS' OR [Asset Group]='S'"))

View 11 Replies View Related

Queries :: Grouped Sum With Proportion Of Total (Access 2007)

Feb 20, 2015

I have a table of transactions (close to 1m records) from which I want to query totals by currency and direction (ins and outs) and then also show the proportion of the overall total for each currency. All amounts are absolute (i.e. ins and outs both represented by positive numbers)

To throw some added complexity into the mix, the transaction table records only refer to account (AccountID), which links to a separate account and currency tables.

I can query the sum totals by currency and direction (although I'm not totally happy with the SQL syntax .

Code:
SELECT tblCurrencies.CurrencyCode,
tmp1.SumPay,
tmp1.SumPayUSD,
tmp2.SumRec,
tmp2.SumRecUSD

[Code] .....

I'm struggling to get the proportions per currency though? I tried adding :

Code:
((SumPayUSD+SumRecUSD)/Sum(tblTransactions.USDAmount)) AS Proportion

But it tells me that the specified field 'tblTransactions.USDAmount' could refer to more than one table listed in the FROM clause of the SQL statement.

View 3 Replies View Related







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