tracimcp
asked on
Calculate an average age in SQL Reporting Services off an age range
I have the following in SQL Reporting services:
Age Range #
<65 1
65-69 0
70-74 3
75-79 6
80-84 1
>85 10
Total 21
I need to display the Average Age and I'm not sure to do this. Please help
Age Range #
<65 1
65-69 0
70-74 3
75-79 6
80-84 1
>85 10
Total 21
I need to display the Average Age and I'm not sure to do this. Please help
ASKER
The requirement is for the average age ex. 74 which is what is confusing
>> which is what is confusing
Kindly specify your exact requirements so that we can try to help you out.
Kindly specify your exact requirements so that we can try to help you out.
ASKER
II have the following in a matrix report in SQL Reporting Services. At the bottom of the report it will have total for the ages and also an average age. I'm not sure how to do this will the age range.
Age Range #
<65 1
65-69 0
70-74 3
75-79 6
80-84 1
>85 10
Total 21
Average Age 74
Age Range #
<65 1
65-69 0
70-74 3
75-79 6
80-84 1
>85 10
Total 21
Average Age 74
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT AGE_RANGE, AVG(CNT) as average_val
FROM ur_table
GROUP BY AGE_RANGE
Kindly note that this will ignore NULL values.
Kindly revert if your requirement differs