willjx
asked on
MS ACCESS Query to show % of Records that are of a "Build" Status selection
I have a report that successfully shows the degree of success of specific Performance Measures with the use of a color coded, “Status”. Status is the result of a Query “Build”, calculating the input data against the desired Target: “Red”: More that 10% below target, “Yellow” within 10% of Target, “Green”, At or Exceeds Target.
There is a series of similar reports for each category of the Dept.
Now, the user wants me to include on these same reports–probably on the footer, the % of the total record list for the given Dept that are “Green”.
For example, for one Dept, there are a total of 17 records, and of those, 5 are “Green”.
Consequently, on the footer of this particular report, it should read: 29.4% are “Green”.
I need to know the most efficient use of Query(s) to allow this note to be put on the Report.
There is a series of similar reports for each category of the Dept.
Now, the user wants me to include on these same reports–probably on the footer, the % of the total record list for the given Dept that are “Green”.
For example, for one Dept, there are a total of 17 records, and of those, 5 are “Green”.
Consequently, on the footer of this particular report, it should read: 29.4% are “Green”.
I need to know the most efficient use of Query(s) to allow this note to be put on the Report.
see here:
Database144.mdb
Database144.mdb
Come to think of it, ...you may want to open the Sorting and Grouping options (for the report) and sort the report by "InputValue"
ASKER
Thanks.
However, I can't seem to get it to work.
I really like the idea of just putting it into the Report 'group' footer. But maybe I have some syntax error?
I tried various versions of the 2 examples below, and i just got:
# error at the bottom of my report.
The 3rd example I tried on another report, and the bottom of the report just displayed the script as shown.
=DCount("*","QpmStatusProg ram","Prog ram=" & [Program] & " AND " & "Status='Red'") & " are Red."
=DCount("*","QpmStatusProg ram","Leve l=" & [Program] & " AND " & "Status='Green'") & " are Green."
=DCount("*","QpmStatusDivi sion","Div ision=" & [Division] & " AND " & "Status='Red'") & " are Red."
However, I can't seem to get it to work.
I really like the idea of just putting it into the Report 'group' footer. But maybe I have some syntax error?
I tried various versions of the 2 examples below, and i just got:
# error at the bottom of my report.
The 3rd example I tried on another report, and the bottom of the report just displayed the script as shown.
=DCount("*","QpmStatusProg
=DCount("*","QpmStatusProg
=DCount("*","QpmStatusDivi
1. Always try one expression first to see if that works.
Then add the others
2. Why are you changing the criteria field for each of the expressions?
See the sample db I posted...
It is always: Dept= ...
3. As I mentioned in my earlier post, ...you did not specify the datatype of your fields.
So if Dept is a string, the syntax would be:
"Dept=" & "'" & [Program] & "'" &...
Then add the others
2. Why are you changing the criteria field for each of the expressions?
See the sample db I posted...
It is always: Dept= ...
3. As I mentioned in my earlier post, ...you did not specify the datatype of your fields.
So if Dept is a string, the syntax would be:
"Dept=" & "'" & [Program] & "'" &...
ASKER
1. I understand. I am using MS ACCESS 2007.
2. I see that it works for you DB. I need for it to work in my environment.
In Report design mode there is a warning about the "&". ??
3. Yes. I notice that your "Dept" is NUMERIC. Mine is text -string. So, I will try it with the quotes.
Also remember in the final solution I need the script to have the result:
29.4% are “Green”- "Percent of performance measures that meet the target".
Thanks.
2. I see that it works for you DB. I need for it to work in my environment.
In Report design mode there is a warning about the "&". ??
3. Yes. I notice that your "Dept" is NUMERIC. Mine is text -string. So, I will try it with the quotes.
Also remember in the final solution I need the script to have the result:
29.4% are “Green”- "Percent of performance measures that meet the target".
Thanks.
ASKER
ok.
I got the script you provided to replicate what happened in your DB.
"5 are Green" -Good.
Now. apparently needed is for the script to count the # records, and divide the "5" by the # of records to get the requested result:
29.4% are “Green”- "Percent of performance measures that meet the target".
I got the script you provided to replicate what happened in your DB.
"5 are Green" -Good.
Now. apparently needed is for the script to count the # records, and divide the "5" by the # of records to get the requested result:
29.4% are “Green”- "Percent of performance measures that meet the target".
Then it would be roughly something like this:
=Format((Dcount("*","YourT able","You rField='Re d'" & " And " & "Dept=" & YourDept))/dcount("*","You rTable")," Percent") & " are Red -Percent of performance measures that meet the target."
Basically this:
(YourSpecifiCount)/(TotalC ount) ...formatted as a Percent:
Format(YourSpecifiCount/To talCount," Percent")
But I am sure you can get the correct syntax...
;-)
JeffCoachman
=Format((Dcount("*","YourT
Basically this:
(YourSpecifiCount)/(TotalC
Format(YourSpecifiCount/To
But I am sure you can get the correct syntax...
;-)
JeffCoachman
ASKER
This is what I typed:
=Format((Dcount("*","QpmSt atusProgra m","Status ='Red'" & " And " & "Program=" & “Program”))/dcount("*","Qp mStatusPro gram"),"Pe rcent") & " are Red -Percent of performance measures that meet the target."
The report runs and just displays the above script..at the bottom..???
=Format((Dcount("*","QpmSt
The report runs and just displays the above script..at the bottom..???
ASKER
ok
At the bottom of the same report that from the earlier script shows:
5 are Green
the below script:
=Format((DCount("*","QpmSt atusProgra m","Progra ms='Green' " & " And " & "Programs=" & "Programs"))/DCount("*","Q pmStatusPr ogram"),"P ercent") & "are Green-Percent of performance measures that meet the target."
shows:
0.00%are Green-Percent of performance measures that meet the target.
It should show 29%.
At the bottom of the same report that from the earlier script shows:
5 are Green
the below script:
=Format((DCount("*","QpmSt
shows:
0.00%are Green-Percent of performance measures that meet the target.
It should show 29%.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent!
Easily worth 700 points
Easily worth 700 points
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for willjx's comment #a39513882
for the following reason:
I thought I was going to have to create a couple of extra sub queries to achieve the solution.
The solution. all done in Report Design, lends it to easily be copy pasted into all the similar sub division reports.
Thank you.
Accepted answer: 0 points for willjx's comment #a39513882
for the following reason:
I thought I was going to have to create a couple of extra sub queries to achieve the solution.
The solution. all done in Report Design, lends it to easily be copy pasted into all the similar sub division reports.
Thank you.
I am confused here...
You are accepting your own post as the solution?
You are accepting your own post as the solution?
ASKER
No.
Being new to this process.
I inadvertently posted my acknoweldgement of YOUR solution, and then realized I had to click on "Accept as Solution".
My error. My appologies.
willjx
Being new to this process.
I inadvertently posted my acknoweldgement of YOUR solution, and then realized I had to click on "Accept as Solution".
My error. My appologies.
willjx
Ok great,
;-)
Glad I could help.
;-)
JeffCoachman
;-)
Glad I could help.
;-)
JeffCoachman
You can probably use a dcount()
=Dcount("*","YourTable","Y
So in this situation you are getting a count of all the "Reds" for the current Department
So then you could do something like this in a control in the group footer, to display the count, then add the text: "are Red"
=Dcount("*","YourTable","Y
But I would need a simple copy of your database for the exact syntax though .
JeffCoachman