Rayne
asked on
average of calculation (TSQL)
Hi,
There is a table in SQL Server where it looks like that>>
Account | MetricA | MetricB
A1 | 33 |35
B2 | 45 |31
C3 | 32 |106
How do i average those row level percentages
See the attached excel.
Select Account, MetricA, MetricB, (MetricA-MetricB)/MetricB as Change_PCT
Will give me something below >>
Account | MetricA | MetricB| Change_PCT
A1 | 33 |35| -0.057142857
B2 | 45 |31| 0.451612903
C3 | 32 |106| -0.2
If you average the change_PCT – it gives me 6.48%. How do I get that average of change_PCT in TSQL? Average of individual row level calculation?
thank you
EEQUES1.xlsx
There is a table in SQL Server where it looks like that>>
Account | MetricA | MetricB
A1 | 33 |35
B2 | 45 |31
C3 | 32 |106
How do i average those row level percentages
See the attached excel.
Select Account, MetricA, MetricB, (MetricA-MetricB)/MetricB as Change_PCT
Will give me something below >>
Account | MetricA | MetricB| Change_PCT
A1 | 33 |35| -0.057142857
B2 | 45 |31| 0.451612903
C3 | 32 |106| -0.2
If you average the change_PCT – it gives me 6.48%. How do I get that average of change_PCT in TSQL? Average of individual row level calculation?
thank you
EEQUES1.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Gurus
ASKER
'average' is not a recognized built-in function name."