title: SSRS: change font color based on the expression
body: <p>I am trying to give the below expression for font color in ssrs:</p>
  
  <pre><code>=IIF(Fields!A.Value&lt;&gt;0 AND Fields!P.Value &lt;&gt;0, IIF(Fields!A.Value &gt;= Fields!P.Value, "Green", "Red"), "Black")
  </code></pre>
  
  <p>It works fine for all the numbers except when Either of A or P is 0 I am getting both A and P as Black.</p>
  
  <p>Basically, All I want is:</p>
  
  <ol>
  <li>When A = P = 0  Black</li>
  <li>When A >= P (for eg. say both are 5) then Green</li>
  <li>When A &lt; P Red</li>
  </ol>
  
  <p>The IIF syntax did not work as I expected i.e. When I have 0 in P and 5 in A then the font color should be green and the vice versa should be red.</p>
  
  <p>I have to work a way around to get what I want with Switch statement.</p>
  
  <pre><code>=Switch(Fields!A.Value&gt;=Fields!P.Value and (Fields!P.Value&lt;&gt;0 AND Fields!P.Value &lt;&gt;0), "Green",
  (Fields!A.Value = 0 and Fields!P.Value =0), "Black",
  (Fields!A.Value=0 AND Fields!A.Value &lt; Fields!P.Value), "Red",
  (Fields!P.Value = 0 AND Fields!A.Value &gt; Fields!P.Value), "Green")
  </code></pre>
  
  <p>Can someone explain to me why my IIF statement did not work please?</p>
  
  <p>Your help is much appreciated.
  Thank you.</p>