title: Trying to generate an expression from a table based on table values
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>I have this for the code in my expression:</p>
  
  <pre><code>=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))
  </code></pre>
  
  <p>Through another stackoverflow question I found this code and have added it to my report:  </p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <blockquote>
    <p>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'.</p>
  </blockquote>
  
  <p>This is what my output looks like:</p>
  
  <pre><code>*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
  </code></pre>
  
  <p>Overtime %                          #Error</p>
  
  <p>(I'm very sorry, I cannot get the list to indent!)</p>
  
  <p>I am expecting this as my results:</p>
  
  <pre><code>      Overtime %                               0.18% 
  </code></pre>
  
  <p>This is what I am getting instead:</p>
  
  <pre><code>      Overtime %                               #Error
  </code></pre>