J
Jay
I have a query which groups by the field 'Manufacturer' and by the
'SoldMonth' chosen on a form [Forms]![frmSwitchboard]![cboMonth].
The query has a calculated Expression field which counts the grouping per
Manufacturer -
Field: ManufacturerCount: Count(*)
Total: Expression
I have another calculated expression field which calculates the
ManufacturerCount as a percentage:
Field: Percentage: (Count(*)/(SELECT Count(*) FROM
[tblValidationMileages]))*100
Total: Expression
However, the calculated Percentage field calculates the ManufacturerCount as
a percentage of ALL the records in the source table and I want it to be a
percentage of records where the 'SoldMonth' is the same as
Forms]![frmSwitchboard]![cboMonth].
Can anyone advise how I change my query. I'm not very good at writing in
SQL but the code is:
SELECT tblValidationMileages.Manufacturer, Count(*) AS ManufacturerCount,
tblValidationMileages.SoldMonth, (Count(*)/(SELECT Count(*) FROM
[tblValidationMileages]))*100 AS Percentage
FROM tblValidationMileages
GROUP BY tblValidationMileages.Manufacturer, tblValidationMileages.SoldMonth
HAVING
(((tblValidationMileages.SoldMonth)=[Forms]![frmSwitchboard]![cboMonth]));
Many Thanks,
Jason
'SoldMonth' chosen on a form [Forms]![frmSwitchboard]![cboMonth].
The query has a calculated Expression field which counts the grouping per
Manufacturer -
Field: ManufacturerCount: Count(*)
Total: Expression
I have another calculated expression field which calculates the
ManufacturerCount as a percentage:
Field: Percentage: (Count(*)/(SELECT Count(*) FROM
[tblValidationMileages]))*100
Total: Expression
However, the calculated Percentage field calculates the ManufacturerCount as
a percentage of ALL the records in the source table and I want it to be a
percentage of records where the 'SoldMonth' is the same as
Forms]![frmSwitchboard]![cboMonth].
Can anyone advise how I change my query. I'm not very good at writing in
SQL but the code is:
SELECT tblValidationMileages.Manufacturer, Count(*) AS ManufacturerCount,
tblValidationMileages.SoldMonth, (Count(*)/(SELECT Count(*) FROM
[tblValidationMileages]))*100 AS Percentage
FROM tblValidationMileages
GROUP BY tblValidationMileages.Manufacturer, tblValidationMileages.SoldMonth
HAVING
(((tblValidationMileages.SoldMonth)=[Forms]![frmSwitchboard]![cboMonth]));
Many Thanks,
Jason