My SSRS report creates a summarized table. I need to do a calculation based on 2 pieces of data from the table and add it as an expression at the bottom of the report. My expression errors out as it is not reading the data output from the table.
I have followed up on all examples I could find with the error I get, but found no resolution. I am new to SSRS. I have tested the expression by simply using the IIf statement to return the values I'm looking for (without the rest of the calculations I need) and it doesn't return either value. I get "#Error" as the result. I have copied the lookup values directly from the SQL code, so I KNOW there are no typos in my comparison values.
I have this for the code in my expression:
=Code.Divide
(IIf(Fields!Results.Value = "BKR3 - Total Overtime Hours", Fields!Results.Value, 0)) ,
(IIf(Fields!Emp_Type.Value = "BKR1 - Total Paid Hours", Fields!Results.Value, 1))
Through another stackoverflow question I found this code and have added it to my report:
Public Function Divide(ByVal dividend as Double, ByVal divisor as Double) As Double
If IsNothing(divisor) Or divisor = 0 Or IsNothing(dividend) Or dividend=0 THEN
Return 0
Else
Return dividend/divisor
End If
End Function
I am getting this error:
The Value expression for the textrun ‘Textbox3.Paragraphs[0].TextRuns[0]’ contains an error: [BC30455] Argument not specified for parameter 'divisor' of 'Public Function Divide(dividend As Double, divisor As Double) As Double'.
This is what my output looks like:
*Emp_Type Results
*A3-Facility Payroll Hours 28,252.20
*A4-Provider Payroll Hours 1,998.50
*BKR1-Total Paid Hours 30,250.70
*BKR2-Total Worked Hours 27,037.62
*BKR3-Total Overtime Hours 504.20
*BS1-Hospital FTEs 99.72
*BS2-Clinic FTEs 23.25
Overtime % #Error
(I'm very sorry, I cannot get the list to indent!)
I am expecting this as my results:
Overtime % 0.18%
This is what I am getting instead:
Overtime % #Error