473,666 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help - need Cross Tab to Sum AND Count

Hope someone can help me with this - I've been staring at it stupidly
for hours now, convinced there must be an easy way to achieve the
results I want:

I have a very large table recording every sale made by one of 90
salespeople (2 years of data), and the date the sale was made. I need
a report that shows a list of the salespeople down the left hand side
and then for each month the total number of sales and the total value
of sales. I can do a cross tab that works beautifully for each of
these that will group the records by month but I just can't seem to
find a way of combining the information into a useful table.

I know in an Excel Pivot table I would be able to have more than one
row for each salesperson so that I could show the value and the count
for each line but I can't seem to do this in Access. I tried a make
table query and then an append query but that jumbled up the
information into nonsense as I wasn't able to sort it by salesperson
and month.

Am I missing something really obvious here or has anyone got any
bright ideas? I need this to be a simple process that admin staff with
no knowledge of access can run.

Any help enormously appreciated,

Amanda Leslie

_______________ ___

am****@alt1.dem on.co.uk

Nov 13 '05 #1
3 2805
am****@alt1.dem on.co.uk wrote:
Hope someone can help me with this - I've been staring at it stupidly
for hours now, convinced there must be an easy way to achieve the
results I want:

I have a very large table recording every sale made by one of 90
salespeople (2 years of data), and the date the sale was made. I need
a report that shows a list of the salespeople down the left hand side
and then for each month the total number of sales and the total value
of sales. I can do a cross tab that works beautifully for each of
these that will group the records by month but I just can't seem to
find a way of combining the information into a useful table.

I know in an Excel Pivot table I would be able to have more than one
row for each salesperson so that I could show the value and the count
for each line but I can't seem to do this in Access. I tried a make
table query and then an append query but that jumbled up the
information into nonsense as I wasn't able to sort it by salesperson
and month.

Am I missing something really obvious here or has anyone got any
bright ideas? I need this to be a simple process that admin staff with
no knowledge of access can run.

Any help enormously appreciated,

Amanda Leslie

_______________ ___

am****@alt1.dem on.co.uk

While there are likely other ways to do this, what I have done is create
two crosstabs, identical except one counts and the other sums. Also, I
rename the data field that will be the column in each
(newname: [oldname] + "Count"

Then in another query i simply join the two fields together by whatever
fields form the rows.

That way all of the columns of the count cross tab have a name in the
format: xxxxxCount
and all the columns of the sum cross tab have a name in the format:
yyyyySum
Hope I have stated this clearly (I get in trouble here is I mis-state
things)

Bob
Nov 13 '05 #2
Thanks Bob, that's great - and does the job.

However, I'm not sure where to put:

(newname: [oldname] + "Count"

?

Can you advise further!

Many thanks

Amanda Leslie

On Wed, 12 Oct 2005 12:59:48 -0500, Bob Alston
<tu************ ****@cox.net> wrote:
am****@alt1.de mon.co.uk wrote:
Hope someone can help me with this - I've been staring at it stupidly
for hours now, convinced there must be an easy way to achieve the
results I want:

I have a very large table recording every sale made by one of 90
salespeople (2 years of data), and the date the sale was made. I need
a report that shows a list of the salespeople down the left hand side
and then for each month the total number of sales and the total value
of sales. I can do a cross tab that works beautifully for each of
these that will group the records by month but I just can't seem to
find a way of combining the information into a useful table.

I know in an Excel Pivot table I would be able to have more than one
row for each salesperson so that I could show the value and the count
for each line but I can't seem to do this in Access. I tried a make
table query and then an append query but that jumbled up the
information into nonsense as I wasn't able to sort it by salesperson
and month.

Am I missing something really obvious here or has anyone got any
bright ideas? I need this to be a simple process that admin staff with
no knowledge of access can run.

Any help enormously appreciated,

Amanda Leslie

_______________ ___

am****@alt1.dem on.co.uk

While there are likely other ways to do this, what I have done is create
two crosstabs, identical except one counts and the other sums. Also, I
rename the data field that will be the column in each
(newname: [oldname] + "Count"

Then in another query i simply join the two fields together by whatever
fields form the rows.

That way all of the columns of the count cross tab have a name in the
format: xxxxxCount
and all the columns of the sum cross tab have a name in the format:
yyyyySum
Hope I have stated this clearly (I get in trouble here is I mis-state
things)

Bob


Nov 13 '05 #3
am****@alt1.dem on.co.uk wrote:
Thanks Bob, that's great - and does the job.

However, I'm not sure where to put:

(newname: [oldname] + "Count"

?

Can you advise further!

Many thanks

Amanda Leslie

On Wed, 12 Oct 2005 12:59:48 -0500, Bob Alston
<tu************ ****@cox.net> wrote:

am****@alt1.d emon.co.uk wrote:
Hope someone can help me with this - I've been staring at it stupidly
for hours now, convinced there must be an easy way to achieve the
results I want:

I have a very large table recording every sale made by one of 90
salespeopl e (2 years of data), and the date the sale was made. I need
a report that shows a list of the salespeople down the left hand side
and then for each month the total number of sales and the total value
of sales. I can do a cross tab that works beautifully for each of
these that will group the records by month but I just can't seem to
find a way of combining the information into a useful table.

I know in an Excel Pivot table I would be able to have more than one
row for each salesperson so that I could show the value and the count
for each line but I can't seem to do this in Access. I tried a make
table query and then an append query but that jumbled up the
informatio n into nonsense as I wasn't able to sort it by salesperson
and month.

Am I missing something really obvious here or has anyone got any
bright ideas? I need this to be a simple process that admin staff with
no knowledge of access can run.

Any help enormously appreciated,

Amanda Leslie

____________ ______

am****@alt1. demon.co.uk


While there are likely other ways to do this, what I have done is create
two crosstabs, identical except one counts and the other sums. Also, I
rename the data field that will be the column in each
(newname: [oldname] + "Count"

Then in another query i simply join the two fields together by whatever
fields form the rows.

That way all of the columns of the count cross tab have a name in the
format: xxxxxCount
and all the columns of the sum cross tab have a name in the format:
yyyyySum
Hope I have stated this clearly (I get in trouble here is I mis-state
things)

Bob


I use it to rename the field that I want to appear as columns.

Bob
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2978
by: News | last post by:
Folks, I need help with this task. I have a set of data that needs to be plotted on timeline chart. Example: Unit ProcStart ProcEnd Machine U1 5/5/03 6:01 5/5/03 6:04 M1 U2 5/5/03 6:03 5/5/03 6:05 M1 U3 5/5/03 6:03 5/5/03 6:04 M2 : etc. There are about 40K units and 30 serving machines. The data is in
28
3296
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
4
2852
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table that links to a transaction items table that links to the products table: (User Table) UserID Other user data
2
1444
by: Badg3r | last post by:
Hello I'm fairly new to Access but remember just enough programming from school to be frustrated that I can't figure this out. I have a table with AccountNum and MonthNum (as a number from 1 to 12). I need to design a query (maybe a macro?) that will give me the Count of Accounts in Month 1 and then the Count of those Accounts that were also in Month 2, 3, 4 and so on. The tricky part is that I then need to do the same thing for those...
6
1524
by: mutemode | last post by:
I have this query SELECT 'bracket' = CASE WHEN income BETWEEN 0 AND 49 THEN '0-49' WHEN income BETWEEN 50 AND 99 THEN '50-99' WHEN income BETWEEN 100 AND 499 THEN '100-499' WHEN income BETWEEN 500 AND 1000 THEN '500-1000' ELSE 'Other' END, count(income) AS number FROM #persons GROUP BY CASE
0
1280
by: stanlew | last post by:
Happy New Year everyone! I'm new to both T-SQL and this forum. I'm currently doing an internship and my first task was to create a small program which will send an email detailing the sales of the previous day versus monthly targets and sales. Most of the parts were figured out and eveything was done in Visual Studio. The gist of the code was written in one large chunk of SQL code, as below: SELECT derivedtbl_1.family AS 'Family',...
2
1368
by: senchiru | last post by:
All Pls help me writing SQL for the following scenario Table 1 COL1 Table 2 COL1 COL2 ----> FK to TAB1.COL1 (1 to many) COL3 COL4
2
3748
by: lenygold via DBMonster.com | last post by:
Hi Everebody: I have a table: CREATE TABLE CROSS_REFERENCE (ROW# INTEGER NOT NULL ,KEY_WORD CHAR(16) NOT NULL ,QUERY_DESCR VARCHAR(330) NOT NULL ,PRIMARY KEY (ROW#,KEY_WORD)); It is a cross reference table to my CATALOG Table based on key words.
53
8370
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script language="javascript" type="text/javascript">
0
8445
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8871
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7386
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.