I am working on a report that will Sum the Sales (Bid Price Field) that are still Active (Bid Status Field) for the past
1 Week,
2 Weeks,
3 Weeks,
4 Weeks,
30 Days,
60 Days,
90 Days,
120 Days,
150 Days,
180 Days &
over 180 Days
using the (Bid Date Field) from the current date back.
I have a query set up to only show Active bids, figured that was a good place to start, but how to I get it to return the Sum of the Sales for each of the date ranges?
5 2713
OK this is not straightforward but lets try some stuff out to see if we can get it to work. You don't give the date field you reference so I just refer to it as [DateField]. - SELECT Sum([Bid Price Field]) A SumBidPrice,
-
IIf(DateDiff("d",[DateField],Date())<=7,"1 Week",
-
IIf(DateDiff("d",[DateField],Date())>7 And DateDiff("d",[DateField],Date())<=14,"2 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>14 And DateDiff("d",[DateField],Date())<=21,"3 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>21 And DateDiff("d",[DateField],Date())<=28,"4 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>28 And DateDiff("d",[DateField],Date())<=30,"30 days",
-
IIf(DateDiff("d",[DateField],Date())>30 And DateDiff("d",[DateField],Date())<=60,"60 days",
-
IIf(DateDiff("d",[DateField],Date())>60 And DateDiff("d",[DateField],Date())<=90,"90 days",
-
IIf(DateDiff("d",[DateField],Date())>90 And DateDiff("d",[DateField],Date())<=120,"120 days",
-
IIf(DateDiff("d",[DateField],Date())>120 And DateDiff("d",[DateField],Date())<=150,"150 days",
-
IIf(DateDiff("d",[DateField],Date())>150 And DateDiff("d",[DateField],Date())<=180,"180 days",
-
"> 180 Days")))))))))) AS NumDays
-
FROM Table3
-
GROUP BY IIf(DateDiff("d",[DateField],Date())<=7,"1 Week",
-
IIf(DateDiff("d",[DateField],Date())>7 And DateDiff("d",[DateField],Date())<=14,"2 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>14 And DateDiff("d",[DateField],Date())<=21,"3 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>21 And DateDiff("d",[DateField],Date())<=28,"4 Weeks",
-
IIf(DateDiff("d",[DateField],Date())>28 And DateDiff("d",[DateField],Date())<=30,"30 days",
-
IIf(DateDiff("d",[DateField],Date())>30 And DateDiff("d",[DateField],Date())<=60,"60 days",
-
IIf(DateDiff("d",[DateField],Date())>60 And DateDiff("d",[DateField],Date())<=90,"90 days",
-
IIf(DateDiff("d",[DateField],Date())>90 And DateDiff("d",[DateField],Date())<=120,"120 days",
-
IIf(DateDiff("d",[DateField],Date())>120 And DateDiff("d",[DateField],Date())<=150,"150 days",
-
IIf(DateDiff("d",[DateField],Date())>150 And DateDiff("d",[DateField],Date())<=180,"180 days","> 180 Days"))))))))));
-
Thank you, That worked great. One more question.
I am also counting the # of bids in the query
How do I get the sums of each Bid Price (from the previous question) and the Count of Bids (I have it in the query by each of the "NumDays" values) into a report so that I can have each result in a different textbox. (for running calculations)
Example:
the "SumBidPrice" for "1 Week" in a textbox,
the "SumBidPrice" for "2 Weeks" in a different textbox,
ETC...
Becuase I will need the "summed" and "separate" on the report.
Thank you, That worked great. One more question.
I am also counting the # of bids in the query
How do I get the sums of each Bid Price (from the previous question) and the Count of Bids (I have it in the query by each of the "NumDays" values) into a report so that I can have each result in a different textbox. (for running calculations)
Example:
the "SumBidPrice" for "1 Week" in a textbox,
the "SumBidPrice" for "2 Weeks" in a different textbox,
ETC...
Becuase I will need the "summed" and "separate" on the report.
OK change the query to show count of bids as follows -
-
SELECT Sum([Bid Price]) As SumBidPrice, Count([Bid Price] As CountBids
-
IIf(DateDiff( ......
-
I'm afraid this is the best I can do with a crosstab query. -
-
TRANSFORM Sum([SumBidPrice]) AS SumOfSumBidPrice
-
SELECT Sum([SumBidPrice]) AS [Total Of SumBidPrice], CountBids
-
FROM QueryName
-
GROUP BY CountBids
-
PIVOT NumDays In ("1 Week", "2 Weeks","3 Weeks","4 Weeks", "30 days", "60 days", "90 days", "120 days", "150 days", "180 days", ">180 days");
-
Thank You, Things are working fine.
Thank You, Things are working fine.
You're welcome. Glad its working for you.
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Heath |
last post by:
I have serious Access problems so please be gentle.
I have one table that stores the quantities and
net sales for thousands of Products.
I have another table that has fixed costs values
on a...
|
by: laurenq uantrell |
last post by:
I am trying to construct a query that sums sales by salespersons and
only returns a list of salespersons that have a sum of sales lower than
the previous month for whatever date rane is selected....
|
by: Carl |
last post by:
Hi,
I have a query that produces an output similar to the sample shown
below. These records are based on certain criteria and a date range
selected from a form. I need to create some kind of...
|
by: Wired Hosting News |
last post by:
Lets say I have 10 products in 10 different stores and every week I get a
report from each store telling me how many items they have left for each of
the 10 products.
So each week I enter in 100...
|
by: Wired Hosting News |
last post by:
I tried to be breif and give a scenario so as not to be overlooked because
it was soooo long. Let me give you real world.
I am a manufacturer of goods and produce 11 items that are distributed...
|
by: heidan |
last post by:
Dear,
I have a question of representing the relationship of sales invoice's
posting date and post period into RDF.
Let's say every sales invoice has a posting date which records when
this...
|
by: josecruz |
last post by:
I have created a main report, which is controlled with a date range parameter from the main form. The report has several sub reports, which perform calculations (counts and averages at the subreport...
|
by: Del |
last post by:
I have a parameter query that requires the user to enter a Start Date:
and End Date: and pull data between that date range. I am currently
using the following parameter;
Select *
From mytable...
|
by: RZ15 |
last post by:
Hi guys,
I'm really drawing a blank here for how to deal with fiscal months in my monthly sales/receipts reports. My issue is that calculating the months is not as simple as saying 'if the invoice...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |