Michael Robinson
Michael Robinson

Reputation: 1132

SSRS - Getting this error: Numeric aggregate function on data that is not numeric

I have a report that is giving me grief about this statement:

Format((Sum(Fields!Mean.Value)) / RowNumber("category_desc"), "F2")

The mean field is a calculated field that is the sum of five fields in my table. Category_desc is the group.

When I run the report, I get #Error in the textbox and this error in the log:

‘Textbox119.Paragraphs[0].TextRuns[0]’ uses a numeric aggregate function on data that is not numeric.  Numeric aggregate functions (Sum, Avg, StDev, Var, StDevP, and VarP) can only aggregate numeric data.

I don't know why this error is occurring or how I can stop it. Any clues?

Upvotes: 1

Views: 7117

Answers (1)

kyzen
kyzen

Reputation: 1609

First, make sure your calculated field is returning a numeric type - explicitly cast the return value within your expression.

You can also try to eliminate any potential non-numerics coming into your SUM, as it sounds like "Mean" might contain text data:

Sum(iif(IsNumeric(Fields!Mean.Value), CDbl(Fields!Mean.Value), 0))

Upvotes: 4

Related Questions