Share via

Calculation error in SSRS report

Anonymous
2022-08-16T19:23:44.297+00:00

I am getting the #error when trying to sum a calculated field in ssrs text box. I have seen posts regarding division by zero but this has none of that.

The calculated field is appearing correctly in the detail row and I get the error when I try to sum it my equation is
=SUM(IIF(Fields!strType.Value="CreditsAndDeposits",Fields!intDT.Value,0))

+SUM(IIF(Fields!strType.Value="Refunds",Fields!intDT.Value,0))

-SUM(IF(Fields!strType.Value="Rent_Tax",Fields!intDT.Value,0))

-SUM(IIF(Fields!strType.Value="Sales_Tax",Fields!intDT.Value,0))

-SUM(IIF(Fields!strType.Value="Cost_of_Insurance",Fields!intDT.Value,0))

SQL Server Reporting Services
SQL Server Reporting Services

A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.

0 comments No comments

Answer accepted by question author

Joyzhao-MSFT 15,651 Reputation points
2022-08-17T01:52:22.323+00:00

Hi @Jannette Jones ,
Whether the data in the field [Fields!strType] in your original table has CreditsAndDeposits, Refunds, Rent_Tax, Sales_Tax, and Cost_of_Insurance **. I mean are these field values: **CreditsAndDeposits, Refunds, Rent_Tax, Sales_Tax, Cost_of_Insurance exactly as they exist in your original table without any decimal point or the difference in case. Because they may exist as "RentTax" instead of "Rent_Tax" in your table; in your table as "SalesTax" instead of "Sales_Tax".

This expression was originally when I created the test table and the test was successful. You haven't made any changes to your query result table on the expression I gave, which is probably why you keep getting Error.

There is no problem with the expression logic, what you need is to replace the fields and field values in the expression according to your own table, instead of 100% copying the expression I gave.

In any case, if the previous answer was helpful to you, please mark it as "Accept Answer" so that more people in need can get help.

Best Regards,
Joy


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.