Queries :: Fill No Sales Months With 0

Aug 9, 2013

I am pulling sales results per customer and month. For presenting the numbers in a diagram I would like to show 0 sales for months in which no sales were generated. At the moment the query results only the months in which there are sales > 0. Is there a trick that I don't know?

SELECT Year([InvoiceDate]) & ' ' & Month([InvoiceDate]) AS [Month], totalsales_per_invoice([invoices]![InvoiceID],[invoices]![tax]) AS Ausdr1
FROM Invoices INNER JOIN customers ON Invoices.CustomerID = customers.CustomerID
WHERE (((Invoices.InvoiceDate) Between #1/1/2013# And #7/1/2013#) AND ((customers.CustomerID)=145))
GROUP BY totalsales_per_invoice([invoices]![InvoiceID],[invoices]![tax]), Year([InvoiceDate]), Month([InvoiceDate])
ORDER BY Year([InvoiceDate]) DESC , Month([InvoiceDate]) DESC;

View Replies


ADVERTISEMENT

First 10 Months Of Sales, Seems Simple, But Proven To Be A Horrorcase.

Jan 8, 2008

I have a table with historic sales values, so an Item has 36 months starting (Field names are ranging from "Oct 04", "Nov 04", "Dec 04" ... to "Sep 07")
I also have a column name First month of Sale. which is filled with for example "Dec 04", for the next Item is might be "Jun 05" or "Aug 06").

I would like to get a Query where I just show sales values of the first 10 months after that first month of sale.

I have tried, and tried, and tried till my head exploded:mad:
It seems a simple task, but I am obviously overlooking something.
can anyone help me with some hints?

View 5 Replies View Related

Queries :: Date Criteria - Query Previous 12 Months Including Months With No Data

Mar 22, 2013

I currently have a form where users can enter an "End Date", click a button, and it queries the data from 12 months prior to "End Date" entered.

Is there a way to force the query to show all 12 months, even if there are no records for a particular month? For example: if the user enters February 2013 in the date field, I would like the query to return:

March 2012
April 2012
May 2012
June 2012
July 2012
August 2012
September 2012
October 2012
November 2012
December 2012
January 2013
February 2013

...so even if June 2012 has no records, it is included in the query with a value of zero.

This is what I have so far:

WHERE (((Qry_Tbl_Assets.Dte) Between DateAdd("m",-12,[Forms]![Main_screen]![End_Date]) And [Forms]![Main_screen]![End_Date]))

View 2 Replies View Related

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

Queries :: Calculating Fiscal Year Sales In A Query

Feb 18, 2015

I'm making a query that has the following Fields

Product (Table PDZRN1)
Whse (Table PDZRN1)
Description (Table PDZRN1)
On Hand (Table PDZRN1)
Unit Cost (Table PDZRN1)
Unit Price (Table PDZRN1)
LastDate: Date (Table Sales_History) (using the Max function)

Where I am stuck is I want 4 additional columns to pull the last 3 fiscal years and total sales for each Product for the 3 previous fiscal years. The Field with sales amount is "Sales" it is located in Table "Sales_History", and the dates for the invoices are in the field "Date". I tried the following query, but I'm sure it didn't work because I failed to push the data back to the date field:

Field - FY2013Sales: Sales
Table - Sales_History
Total - Sum
Criteria - <= 04/01/2012 and <= 03/31/2013

how to link my criteria back to the "Date" field, or if I'm even going down the write path.

View 14 Replies View Related

Queries :: Sum Of Sales - TOP 5 Agents By State Over Given Date Range

Sep 5, 2013

I want to get the sum of sales of the top 5 best agents by state.

I have been able to do the following, however, this only gives me the state of "vic". I want it to show all states.

SELECT TOP 5 filedata.Debtor, Debtors.FullName, Sum(filedata.NetTotal) AS SumOfNetTotal, Debtors.State, Count(filedata.BorQ) AS CountOfBorQ
FROM filedata INNER JOIN Debtors ON filedata.Debtor = Debtors.Code
WHERE (((filedata.BorQ)="b") AND ((filedata.DepDate) Between [Forms]![F-financemenu].[startdate] And [Forms]![F-financemenu].[enddate]))
GROUP BY filedata.Debtor, Debtors.FullName, Debtors.State
HAVING (((Debtors.State)="vic"))
ORDER BY Sum(filedata.NetTotal) DESC;

which returns

DebtorFullNameSumOfNetTotalStateCountOfBorQ1429ABC company147150VIC11360XYZ Company107204.55VIC32534MNO organisation68799.86VIC31168PQR business58934.67VIC31326FGH industries32480VIC2

(count of BorQ) is the number of sales

I have tried using UNION ALL and changing the State but that only caused syntax errors.

View 2 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 :: Allocate Annual Sales By Month And Work Day

Dec 1, 2014

On the surface this seems easy, but I am struggling. two tables

tbldata (four fields 6,270 rows)
custid 2015cellcode 2015qty 2015amt
12673 1243 100 1,000.00
12673 1250 200 2,000.00
etc etc

tblmntlyalloc (Three fields and 12 rows i.e. one row for each month)
2015mnth, 2015allocation, 2015wrkdays
jan 98 20
feb 93 19
etc etc etc

So in order to handle seasonality of sales, the sales department is given 1,200 points. you can then allocation any number of points (75 - 125) per month. But the total number of points must equal 1,200. So I created a table with the monthly allocation and workdays. I could hard code the % and work days into the formula like this

Jan1[2015amt]*(98/1200)) / 20
Feb1[2015amt]*(93/1200)) / 19

And this does work very well to get me my daily sales amount per month/wrkday

However I know sales will change the monthly allocation (still totals 1200) and HR could even have a change to the holiday schedule. So I want to utilize the table.

So my query brings in both tables, but they are not linked. And this is my formula.

Jan1[2015amt]*([2015allocation]/1200) / [2015wrkdays]
Feb1[2015amt]*([2015allocation]/1200) / [2015wrkdays]
Mar1[2015amt]*([2015allocation]/1200) / [2015wrkdays]
Apr1[2015amt]*([2015allocation]/1200) / [2015wrkdays]
etc etc for 12 months

So I need it to find the value for Jan in the Jan formula, and Feb in the feb formula etc. I cannot determine the correct query formula.

View 8 Replies View Related

Queries :: Table Of End Of Week Sales - Query Where There Is No Match

May 4, 2014

I have a table of end of week sales with ProductID, Volume_Sold, Year and WeekNo. I am about to create a historical table of RRP.

What is the best way to set this out so that I can query the two tables to that when I run a query over the two tables I get the correct price depending on the year and week number I am working with.

tblSales
Year int,
Week int,
CountryCode nvarchar (2),
StoreNo, nvarchar (35),
ProductId nvarchar (15),
Volume_Sold int;

My new table
"tblRRP"
Could contain
Year int,
Week int,
CountryCode nvarchar (2),
ProductId nvarchar (15),
RRP float;

The table is only appended to when the price changes. So some products may have a price increase 2 or 3 times a year others once every 18 months. And if the price changes any calculations need to allow for the 2 or 3 different RRPs the Product may have had during the queried period.

So that when I do year on year revenue calculations it works properly.

View 6 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

Queries :: Comparing Two Tables Across Months

Sep 16, 2013

As a Access newbie I am looking into a problem that I hope to solve structurally and "transparently" via Access in stead of Excel.

I would like to compare two similar tables for different months. I am looking for:

+ loan id's that are new in table(t), i.e. not exist in table(t-1)
+ loan id's that exited: that is exist in table(t-1) and not in table(t)
+ loan id's that stayed in both

How do I solve this in the easiest way?

View 4 Replies View Related

Queries :: All Records With 12 Months Of Date?

Aug 6, 2014

We have a field (tbl_Enrolment.CourseCompletedOn) which holds the date a colleague completed a course. I want to bring through all courses completed within 12 months of todays date ( Date() ) from our database. I checked google and it suggested YEAR but that would only bring through dates with the same year, not within a 12 month period.

View 4 Replies View Related

Queries :: Pick Up Data For Last Two Months

Mar 3, 2015

I have a query that pulls data for the current month and the last two months. It had been working fine until 2015. The problem is that it's looking for the last two months but for 2015. How do I edit my formula to pick up the two months and for it to know it's a different year??

Code:
CMSPM2: IIf([LOB]="CMS" And Month([Month])=Month([Forms]![Main Menu]![EndDate])-2,Count([Question]),0)

View 2 Replies View Related

Queries :: Calculating Years / Months And Days

Aug 6, 2014

I'm trying to breakdown a date into years, months, and days. Simple right?

The code I've been using for months returns a negative month if it happens to be the next month. Instead of returning 1 Year, 1 Month, 23 Days, it will instead return 1 Year, -1 Month, 23 Days.

Code is:

Code:
Months: IIf(IsNull([TIR]),0,IIf(Day([TIR])<=Day(Date()),DateDiff("m",[TIR],Date())-[Years]*12,DateDiff("m",[TIR],Date())-[Years]*12-1))

View 4 Replies View Related

Queries :: Dates Showing Up For Multiple Months?

Jun 18, 2015

I have a query that is supposed to be showing todays data (as it is labeled) but it keeps pulling today's number date (i.e. the 1st, or the 17th) for every month, when i only want June 18th not including jan/feb/march etc. 18th.

I started running this query in may, that's why it only shows may and june's data.

I'm thinking it's definitely a problem with the criteria but check out the attachments and let me know

View 14 Replies View Related

Queries :: Crosstab Query Using Dates For Next 12 Months

Jun 23, 2014

I want to create a cosstab query with dates for the next 12 months accross the top as columns and employee names down the side as rows. I then want to populate with data showing what each person is programed to do under the dates. For instance trainer 1 is delivering training from the 23/06-30/06 then designing a course from 02/07-10/07. that type of thing.

I could represent an activity using a colour i.e. yellow for delivery, green for design etc.

Also do I need to create a table with all the dates? Is there a quick way of doing this?

View 7 Replies View Related

Queries :: Sort Months Logically And Not Alphabetically

Mar 3, 2015

I have a report (based on a query)which informs staff of students who withdrew from our school, and the month and date they withdrew (sorted ascending). I am grouping by month and it looks like the attachment I've included.

It works well enough, but what I would really like is for the month column (Month([withdrawldate]) to show January for 1, February for 2, and so on, but I find that when I do that, the months sort alphabetically, and not logically.

View 14 Replies View Related

Queries :: Running 12 Months Query By Period Value

Oct 8, 2014

I'm having problems figuring this one out -- I'm fairly new to access. I have included a JPG attachment that shows the information I currently have in use and what I would like. I need a SQL statement that will generate the rolling 12 months by period.

The end results will be a table that is populated with the rolling 12 month values so I can qry a sharepoint infopath form to look up the rolling value (look up against lng_PERIOD and chr_EE_RACF) to populate the YTD values.

View 4 Replies View Related

Queries :: Building A Query To Pick Between Set Months / Days But Different

May 4, 2014

I am building a database with Access 2013. The information contains data built from a workplace violence report form. I have to build a query to pick the data but must fall between two different years.The data range must be from 09/01 previous year (ex. 2012) and 08/31 current year (ex. 2013).

As the database collects more information, the year range will change but the other information will stay the same (ex 09/01/2013 to 08/31/2014).I do not want to change the query annually, just let it change the year automatically.

View 1 Replies View Related

Queries :: Months To Be Find From Numeric Month Field

Nov 15, 2013

i have to process 3 upcoming months bills .. say i want to show in query like this bill for Nov, Dec, Jan based on the issue date i mentioned earlier and the months to be find from the numeric month field like 3 i mentioned which mean 3 months ahead from issue date.

View 8 Replies View Related

Queries :: Fee Payment Mode - Display Next Number Of Months

Dec 12, 2013

I have to make program for a school

Some students pays fee for one month, some for two months and some 3 months.

School administration requires me to print notices for every student according their payment mode after comparing with next due months and already paid months.

Some notices will show their fee for the months as

(Id= 1 Jan-14, Feb-14),
(Id=2 Jan-14, Feb-14, Mar-14),
(Id =3 Dec-13, Jan-14) Considering as Id 3 has not paid due month i.e. Dec-13 Fee and his payment mode is 1 month only.

Here Id means Id number alloted to Students.

View 1 Replies View Related

Queries :: Date Range Calculation Including Partial Months

Aug 28, 2013

Trying to get a formula or function for calculating profit for each month between selected dates. Partial month calculations are required.

Source Data (record) examples:
Contract1: Startdate = 6/30/12; EndDate = 9/22/12; DailyProfit = $500; MonthlyProfit = $9500
Contract2: Startdate = 7/7/15; EndDate = 12/17/12; DailyProfit = $600; MonthlyProfit = $11400
Contract3: StartDate = 8/1/12; EndDate = 6/30/13; DailyProfit = $350; MonthlyProfit = $6650

User Query #1:
Notes:
ReportStartDate will always be entered as the first day of the month;
ReportEndDate will always be entered as the last day of the month
The report will always show 6 consecutive months

User selects
ReportStartDate = 7/1/12;
ReportEndDate = 12/31/12

Notable conditions:
-The calculation for Contract 1 will have a partial month profit calculated for September 2012. The other months can show the MonthlyProfit value, with October and December being $0.
-The calculation for Contract 2 will have a partial month profit calculated for July 2012 and December 2012. The other months can show the MonthlyProfit value.
-The calculation for Contract 3 will have no partial months since the StartDate is on a month beginning, and the ReportEndDate is prior to the EndDate. July 2012 will show $0.

Request: I either need a super complicated IIF statement for 6 fixed columns in a query (one column for each month) or a smart function, neither of which I can do.

View 6 Replies View Related

Queries :: Dates In A Query - Show Orders By Month For Last 12 Months

Apr 22, 2013

I want to create a simple query from a list of orders dating back over 12 months.

The fields I have is Ord_Date, Qty

I need to show the orders by month for the last 12 months.

The problem I am getting is that the orders for the month of April (as we are in April now) contain orders from 1st - 22nd April 2013 and orders from 23rd - 30th April 2012, therefore confusing the figures.

I would just like orders grouped by month with a total qty dating back 12 months, but without any old orders for the current month.

View 6 Replies View Related

Total Daily Sales Queries By Model/Total

Mar 8, 2008

Hi,

1) I am pretty newbie to this access programming, do forgive me if my questions sounds stupid.

2) Basically I create an application in access capturing or production information for my company. now the top management suddenly wanted whats their main concern:- Total Daily/Monthly, Quarterly, Annual Sales (By Model If possible)

3) I start with daily (Lets don't be too overly ambitious).

4) I try to let user select dates from my calender control and reflect daily sales (in Total & By Model break down) insert into my form.

5) Understand someone told me from my previous post in Calender control I can achieve it either through forms or queries, which is a better way. (in terms of flexibility to change for program maintenance/ scalibility) wise ?

PS: Please forgive my ignorance :o:(

Thanks (In advance) & God Bless.

View 2 Replies View Related

Queries :: Auto-fill One Column From Another

Jun 11, 2014

I have a situation where, in a query, I need to autofill the column called "Xferd Vendor No" from the column called "Vendor No", where if the data in the Vendor No column changes, then the autofill changes to match.The one called Autofill Raw Data.xlsx shows the expected query results. The one called autofill Final Output.xlsx shows the final results I need when the task is completed.

View 2 Replies View Related

Queries :: Auto Fill Table Field

May 7, 2014

I have been away for Access for a long time and having issue with making a query. I have 3 tables. "tablEmployee" has employee ID, first name, last name and sizer ID. "tblproduct" has product ID, Description and rate. I made a new table called tbldata which has date, product code, product description, product rate,employee id, employee sizer id, and lbs. I want a query when I enter the product id in tbldata, query auto fill the product description and rate. also same as employee.

View 3 Replies View Related







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