title: Does the iif function compute both paths in SSRS or is it short-circuited?
body: <p>I am trying to evaluate a Price per Kilo ($/Kg) based on sales of a product.  This works fine if the product was acutally sold during the period specified.  However if the product is not sold the Kg (the denominator) ends up being 0 (zero) and an error results. - Divide by Zero error.</p>
  
  <p>I tried this</p>
  
  <pre><code>=iif(KgSold=0,0,Revenue/KgSold)
  </code></pre>
  
  <p>It appears that the <code>iif</code> function is calculating both the true and false results.  How do I get around this.</p>
  
  <p>Should I be using the <code>switch</code> function instead?</p>
  
  <pre><code>=switch(KgSold=0,0
          KgSold&lt;&gt;0,Revenue/KgSold)
  </code></pre>