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”:
[code=sql]
TRANSFORM Nz(Sum([tblStaticAllFor ecast].[GWP]),"0") AS GWP
SELECT tblStaticAllFor ecast.LOB
FROM tblStaticAllFor ecast
GROUP BY tblStaticAllFor ecast.LOB
PIVOT tblStaticAllFor ecast.FWeek;
[/code]
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.
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”:
[code=sql]
TRANSFORM Nz(Sum([tblStaticAllFor ecast].[GWP]),"0") AS GWP
SELECT tblStaticAllFor ecast.LOB
FROM tblStaticAllFor ecast
GROUP BY tblStaticAllFor ecast.LOB
PIVOT tblStaticAllFor ecast.FWeek;
[/code]
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.
Comment