Hi
I'm trying to create a query which gives an output something like...
[tt]
ScoreDist Tot %age
1. >= 85% 303 49.11
2. 75% - 85% 187 30.31
3. 50% - 75% 110 17.83
4. < 50% 17 2.75
Total assessments 617
[/tt]
I've got the Score distribution and Total columns nailed down but what I cannot get my head around is how to calculate the percentages (%age column) within the query.
The three fields I'm using are
1. OverallScore, a number between 0 (0%) and 1 (100%)
2. AssessmentNumber, an auto-number field
3. InputDate, a date field
The query I'm currently using is...
[tt]SELECT
IIf(OverallScore>=0.85,"1. >= 85%",
IIf(OverallScore>=0.75,"2. 75% - 85%",
IIf(OverallScore>=0.50,"3. 50% - 75%",
"4. < 50%")) AS ScoreDist,
Count(AssessmentNumber) AS Tot
FROM qryAssess_ALL_LinkedData
WHERE (InputDate BETWEEN Forms.frmReports.calFrom.Value And Forms.frmReports.calTo.Value)
GROUP BY
IIf(OverallScore>=0.85,"1. >= 85%",
IIf(OverallScore>=0.75,"2. 75% - 85%",
IIf(OverallScore>=0.50,"3. 50% - 75%",
"4. < 50%"))
UNION SELECT "Total assessments", Count(*)
FROM qryAssess_ALL_LinkedData
WHERE (InputDate BETWEEN Forms.frmReports.calFrom.Value And Forms.frmReports.calTo.Value);[/tt]
Any help or pointers would be greatly appreciated. I'm thinking that maybe this will have to done with a bit of VB code within a module and using a temporary table. I'm hoping that someone out there can help me out with a nice elegant solution using a query or two.
Good luck people and thanks in advance!
Andy
I'm trying to create a query which gives an output something like...
[tt]
ScoreDist Tot %age
1. >= 85% 303 49.11
2. 75% - 85% 187 30.31
3. 50% - 75% 110 17.83
4. < 50% 17 2.75
Total assessments 617
[/tt]
I've got the Score distribution and Total columns nailed down but what I cannot get my head around is how to calculate the percentages (%age column) within the query.
The three fields I'm using are
1. OverallScore, a number between 0 (0%) and 1 (100%)
2. AssessmentNumber, an auto-number field
3. InputDate, a date field
The query I'm currently using is...
[tt]SELECT
IIf(OverallScore>=0.85,"1. >= 85%",
IIf(OverallScore>=0.75,"2. 75% - 85%",
IIf(OverallScore>=0.50,"3. 50% - 75%",
"4. < 50%")) AS ScoreDist,
Count(AssessmentNumber) AS Tot
FROM qryAssess_ALL_LinkedData
WHERE (InputDate BETWEEN Forms.frmReports.calFrom.Value And Forms.frmReports.calTo.Value)
GROUP BY
IIf(OverallScore>=0.85,"1. >= 85%",
IIf(OverallScore>=0.75,"2. 75% - 85%",
IIf(OverallScore>=0.50,"3. 50% - 75%",
"4. < 50%"))
UNION SELECT "Total assessments", Count(*)
FROM qryAssess_ALL_LinkedData
WHERE (InputDate BETWEEN Forms.frmReports.calFrom.Value And Forms.frmReports.calTo.Value);[/tt]
Any help or pointers would be greatly appreciated. I'm thinking that maybe this will have to done with a bit of VB code within a module and using a temporary table. I'm hoping that someone out there can help me out with a nice elegant solution using a query or two.
Good luck people and thanks in advance!
Andy