473,659 Members | 3,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crosstab Query Report Problem Build

kcdoell
230 New Member
Hello Everyone:

I have a table called “tblStaticAllFo recast”, below are the fields I am currently focusing on within the table:

LOB [this is my product list that has 22 products; text]
GWP [Gross Written Premium; numeric]
FWeek [Drop down list of numbers 1-5; numeric]

Any given LOB can have a GWP and FWEEK assigned to it. For example:

LOB---------GWP----------FWeek
Trains------1,506---------------1
Trains------1,888---------------2
Trains------2,056---------------1
Cars--------1,577---------------1
Cars--------2,999---------------1
Cars--------1,999---------------2
Cars--------3,999---------------1
etc...

What I am trying to do is create a report that shows all LOB’s (Products) GWP (Amount) for that give FWeek (Week).

I thought the best way of doing this was to write a crosstab query using Access’s query builder, but of course I never did this before. Below is what I currently got to work: “SQL design view”:

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Nz(Sum([tblStaticAllForecast].[GWP]),"0") AS GWP
  2. SELECT tblStaticAllForecast.LOB
  3. FROM tblStaticAllForecast
  4. GROUP BY tblStaticAllForecast.LOB
  5. PIVOT tblStaticAllForecast.FWeek;
  6.  
My problem is that it does not show all LOBs (Products), in this case it only showed 17 out of the 22 and it also does not show all of the FWeek (Week), in this case it only showed 3 out of the 5. I am using the “Nz” to propagate zeros for null values for GWP but I don’t know how to have, a column or a row heading to propagate if there is no data on them yet.

Any ideas would be great.

Thanks,

Keith.
Apr 28 '08 #1
3 1436
kcdoell
230 New Member
Hello again:

I was doing some research and found out that the "In clause" assures that you always get the same consistent number of columns even if no data is present. I expanded off of my existing SQL and came up with the following:

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Nz(Sum(tblStaticAllForecast.GWP),"0") AS GWP
  2. SELECT tblStaticAllForecast.LOB
  3. FROM tblStaticAllForecast
  4. GROUP BY tblStaticAllForecast.LOB
  5. PIVOT "Week" & Format([FWeek]) In ("Week 1","Week 2","Week 3","Week 4","Week 5");
The result is that all my Week columns are present but for some reason all the values are zero. The selections in my “FWeek” field are (1,2,3,4,& 5) so I am thinking that that is where I am going wrong. Since I am new with this, does anybody know where I am going wrong in the code? Can I apply this same logic to the row heading as well??

Any ideas would be great,

Thanks,

Keith.
Apr 29 '08 #2
kcdoell
230 New Member
The Logic for the column was:

Expand|Select|Wrap|Line Numbers
  1. PIVOT "Week" & Format([FWeek]) In ("Week1","Week2","Week3","Week4","Week5");
Still working on the row headings showing......, any ideas please let me know.

Thanks,

Keith.
Apr 29 '08 #3
kcdoell
230 New Member
Hello I am going to open another thread and close this one to better explain my problem.....

Keith.
May 1 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4380
by: James Neumann | last post by:
Environment: Access 2k, win2k Business Problem: I have to display returns on investments made over a period of years, and show the amount of return earned on each investment by year. For example, if you placed some money in 2001, you'd want to see the returns on that for 2002, 2003, 2004 etc. (These are long-term investments, so it's quite reasonable to track themin this manner - I wouldn't take this approach aon an active...
8
7564
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I want them to do as little as possible when they run their reports. I have a crosstab query that displays usage of items for each month. It looks pretty much like this: ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC. 1 Solution ...
1
1415
by: Ima Lostsoul | last post by:
Is there a way to mak ea dynamic report from a cross tab query? Basically the query may generate a different number of columns of data depending on the conditions that are set at run time. For example.... Assume: 1) The rows lists managers. 2) The columns list employees. 3) The 'grid' lists a count of tasks.
1
17657
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
2
3039
by: Sherman H. | last post by:
I have a few questions for crosstab and popup form questions: 1. I created a crosstab as follows: IT Financial Operation John 21 22 22 Mary 15 17 16 Joe 28 29 31 For some other instances, the Operation column was not created because the
2
2931
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic sub-report will capture what grades the student has achieved in a list of different subjects and the reason I need it to be dynamic is that students take different subjects. Basically I've been trying to doctor the KB article on dynamic
2
2535
by: scott.k.fraley | last post by:
....and the SELECT thats trying to pull from said Query doesn't like it one bit! ;) I'm working on this project (in Access 2002) and there is a report who's RecordSource is the following SELECT; SELECT xTab.FirstOfPRIORITZTN_STATUS_NAME, xTab., iif(IsNull( xTab. ), 0, xTab.) AS ,
8
6073
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same number of records(generated from a table of predefined 'timeslots'). The number of columns(one for each Consultant) varies depending on how many of the Consultants have a yes/no field('Participates') set to yes. Therefore the Crosstab query...
2
1684
by: Phil Latio | last post by:
My quandary is this..... I have a label application (Bartender) that I have hooked up to Access, to use the output of a cross tab. I've succeeded in getting the data within Access, but my problem lies with my getting the output of the crosstab into one field in the label template. Basically, my crosstab of cloth sizes and quantities, which could be in
14
7841
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
8428
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
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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
8748
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
8531
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.