How to add Percentages to the detail section of a report

S

Slowhaands

I have a simple Access query that summaries a table based on Year and a field
with three possible values.

This query:

SELECT Year([Hire Quality Data]![Hire Date]) AS [Hire Year], [Hire
Quality].[Hire Quality], Count([Hire Quality Data].[Employee Number]) AS
[Hire Count]
FROM [Hire Quality Data] INNER JOIN [Hire Quality] ON [Hire Quality
Data].[Employee Number]=[Hire Quality].[Employee Number]
GROUP BY Year([Hire Quality Data]![Hire Date]), [Hire Quality].[Hire Quality];


Gives me these values

Hire Year Hire Quality Hire Count
2005 Good Hire 74
2005 Mis Hire 16
2006 Good Hire 125
2006 Mis Hire 39
2007 Good Hire 94
2007 Mis Hire 32
2007 New Hire 1
2008 Mis Hire 2
2008 New Hire 68

I am trying to create a report based on this query that includes a column
for Percentage by years. So the 2005 grouping on the report would show 2
records, one with a count of 74, the second with a count of 16. I am trying
to add a Percentage column that would show 82% on the first line in the 2005
group and 18 on the second.

Help please, helping my girlfriend wtih this and she is up against a
deadline on this.

Thanks
 
M

Marshall Barton

Slowhaands said:
I have a simple Access query that summaries a table based on Year and a field
with three possible values.

This query:

SELECT Year([Hire Quality Data]![Hire Date]) AS [Hire Year], [Hire
Quality].[Hire Quality], Count([Hire Quality Data].[Employee Number]) AS
[Hire Count]
FROM [Hire Quality Data] INNER JOIN [Hire Quality] ON [Hire Quality
Data].[Employee Number]=[Hire Quality].[Employee Number]
GROUP BY Year([Hire Quality Data]![Hire Date]), [Hire Quality].[Hire Quality];


Gives me these values

Hire Year Hire Quality Hire Count
2005 Good Hire 74
2005 Mis Hire 16
2006 Good Hire 125
2006 Mis Hire 39
2007 Good Hire 94
2007 Mis Hire 32
2007 New Hire 1
2008 Mis Hire 2
2008 New Hire 68

I am trying to create a report based on this query that includes a column
for Percentage by years. So the 2005 grouping on the report would show 2
records, one with a count of 74, the second with a count of 16. I am trying
to add a Percentage column that would show 82% on the first line in the 2005
group and 18 on the second.


Add a text box (named txtYearTotal) to the year group header
section and set its control source to =Sum([Hire Count])

Then the expression in the percentage text box would be:
=[Hire Count] / txtYearTotal
 
S

Slowhaands

My Very Very Dear and Good Friend Marshall!!!!

Thank you soo very much for saving my butt!!!!

Worked like a charm.

I already had the text box in the Footer, I didn't think of just using the
text box in that way.

Again My Most Profuse Thanks

Marshall Barton said:
Slowhaands said:
I have a simple Access query that summaries a table based on Year and a field
with three possible values.

This query:

SELECT Year([Hire Quality Data]![Hire Date]) AS [Hire Year], [Hire
Quality].[Hire Quality], Count([Hire Quality Data].[Employee Number]) AS
[Hire Count]
FROM [Hire Quality Data] INNER JOIN [Hire Quality] ON [Hire Quality
Data].[Employee Number]=[Hire Quality].[Employee Number]
GROUP BY Year([Hire Quality Data]![Hire Date]), [Hire Quality].[Hire Quality];


Gives me these values

Hire Year Hire Quality Hire Count
2005 Good Hire 74
2005 Mis Hire 16
2006 Good Hire 125
2006 Mis Hire 39
2007 Good Hire 94
2007 Mis Hire 32
2007 New Hire 1
2008 Mis Hire 2
2008 New Hire 68

I am trying to create a report based on this query that includes a column
for Percentage by years. So the 2005 grouping on the report would show 2
records, one with a count of 74, the second with a count of 16. I am trying
to add a Percentage column that would show 82% on the first line in the 2005
group and 18 on the second.


Add a text box (named txtYearTotal) to the year group header
section and set its control source to =Sum([Hire Count])

Then the expression in the percentage text box would be:
=[Hire Count] / txtYearTotal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top