I have a table and each record lists a Company Name, Order Date, and an
Extended Sell Price. What I need to create is a report with 4
columns: Company Name, 2004 Sales, 2005 Sales, 2006 Sales. Each year's
sales will be the sum of the Extended Sell Price for that company
during that year. So the final result will be a list of companies, and
to the right of them, each companies sales totals for each year.
What's the easiest way to do this? 3 1307
Make a query on your table.
Chose
CompanyName
2004 Sales: DSum("ExtendedSellPrice","YourTableName", "Year(OrderDate)
= 2004 And CompanyName = '" & [CompanyName] & "'")
2005 Sales: DSum("ExtendedSellPrice","YourTableName", "Year(OrderDate)
= 2005 And CompanyName = '" & [CompanyName] & "'")
2006 Sales: DSum("ExtendedSellPrice","YourTableName", "Year(OrderDate)
= 2006 And CompanyName = '" & [CompanyName] & "'")
as your fields.
You will want to select unique values, so change the setting in the
query's properties. Right click in the top window, select properties,
change unique values to yes.
Hope that helps!
igendreau wrote:
I have a table and each record lists a Company Name, Order Date, and an
Extended Sell Price. What I need to create is a report with 4
columns: Company Name, 2004 Sales, 2005 Sales, 2006 Sales. Each year's
sales will be the sum of the Extended Sell Price for that company
during that year. So the final result will be a list of companies, and
to the right of them, each companies sales totals for each year.
What's the easiest way to do this?
Any reason you can't use the crosstab query? There's an example of
almost exactly what you're asking in NWind.
TRANSFORM Sum(CCur([Order
Details].[UnitPrice]*[Quantity]*(1-[Discount])/100)*100) AS
ProductAmount
SELECT Products.ProductName, Orders.CustomerID, Year([OrderDate]) AS
OrderYear
FROM Products INNER JOIN (Orders INNER JOIN [Order Details] ON
Orders.OrderID = [Order Details].OrderID) ON Products.ProductID =
[Order Details].ProductID
WHERE (((Orders.OrderDate) Between #1/1/1995# And #12/31/1995#))
GROUP BY Products.ProductName, Orders.CustomerID, Year([OrderDate])
PIVOT "Qtr " & DatePart("q",[OrderDate],1,0) In ("Qtr 1","Qtr 2","Qtr
3","Qtr 4");
igendreau wrote:
I have a table and each record lists a Company Name, Order Date, and an
Extended Sell Price. What I need to create is a report with 4
columns: Company Name, 2004 Sales, 2005 Sales, 2006 Sales. Each year's
sales will be the sum of the Extended Sell Price for that company
during that year. So the final result will be a list of companies, and
to the right of them, each companies sales totals for each year.
What's the easiest way to do this?
How about this?
TRANSFORM Sum(xtbBase.[Extended Sell Price]) AS [SumOfExtended Sell
Price]
SELECT xtbBase.CompanyName
FROM xtbBase
GROUP BY xtbBase.CompanyName
PIVOT Format([OrderDate],"yyyy"); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John |
last post by:
I have a problem, it's not with any code I have because... there is no code.
When I run a blank visual basic 6 form, it opens up just fine. When I add a
text box, a caption, and a button... it...
|
by: El_Embozador |
last post by:
Hi , please can you tell how i can print an MS ACCESS Report form visual
basic, i ned a sample code ..
Thanks
|
by: Me |
last post by:
Hi all,
I have an app in which I need to create a packing slip. I have designed in
report designer. The data is pulled from a SQL database. My question is
how can I put information from the...
|
by: Cherrish Vaidiyan |
last post by:
hello googles,
I have a small sqlplus problem. i have created a table with date field
along with other varchar2,number etc. But unfortunately i made a
mistake in entering the date. for some date...
|
by: Peter Schmitz |
last post by:
Hi,
I'm totally new to crystal reports (for VS.Net 2003), so please excuse if
this question is trivial:
In my application, the user is able to create XML- files, that always
contain...
|
by: Greg Teets |
last post by:
I am new to VB and Access reports.
Is it correct to say that VB and Access have the same report engine or
method?
After I do all the dragging and dropping, is there a way to see the
specs for...
|
by: |
last post by:
I was trying to display a report on a web page. I added a report object to
my project and dropped a report viewer control on the page. I assigned the
reportsource property in page_load, but I...
|
by: Christopher Lusardi |
last post by:
How do I do a Load with the default CrystalReport1.rpt file location
that VB gives me?I.E.: This file is created by VB, but I have to
specify it in the Load. The key question is I do not want to...
|
by: ranesmitas |
last post by:
i want to use crystal report in visual basic as i am new , i want to know i create crytal report in visual basic . we want to create designer (crystal report) in visual basic or in seagate crystal...
|
by: firozfasilan |
last post by:
I am new to visual basic 2008. In the past I have used vb6 to display an existing crystal report. I would like to accomplish the same with vb.net. However I am not clear on the syntax to display a...
|
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: 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: 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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |