Crystal Formula to SSRS

I am working on converting my formula field from crystal report to SSRS calculated field. I’m no expert in either one. How can I fix it? My SSRS error says “expression used for the calculated field includes an aggregate.”

Crystal Formula:
IF Count ({@CalcLateFlag}, {BAQReportResult.Vendor.VendorID}) = 0 THEN 0 ELSE
Sum ({@ONTIME}, {BAQReportResult.Vendor.VendorID})/Count ({@CalcLateFlag}, {BAQReportResult.Vendor.VendorID})*100

My SSRS Version:
=IIF(Count(Fields!CalcLateFlag.Value) = 0, 0, Sum(Fields!ONTIME.Value) / Count(Fields!CalcLateFlag.Value) * 100)

Note: My dataset is “BAQReportResult”. I am not sure where to place this.

Thoughts?

Thanks,
Koecher Vue

Try this:

=IIF(Count(Fields!CalcLateFlag.Value, “BAQReportResult”) = 0, 0, Sum(Fields!ONTIME.Value, “BAQReportResult”) / Count(Fields!CalcLateFlag.Value, “BAQReportResult”) * 100)

It gave me the same error.

From what I can see, you cannot have an aggregate function in a calculated field.
Try creating a textbox on your report and use the formula in its expression.

1 Like