title: How to do conditional sum in Crystal Report
body: <p>Question originally <a href="https://es.stackoverflow.com/questions/300253/suma-condicional-en-crystal-report">posted in Spanish, on es.stackoverflow.com</a>, by <a href="https://es.stackoverflow.com/users/63378/sebasti%c3%a1n-miranda">Sebastián Miranda</a>:</p>
  <blockquote>
  <p>I am working with Crystal Report since Visual Studio 2017, I was asked
  to make a sum to group, I have 3 options: Credit Notes, Ballot and
  Invoice.</p>
  <p>The first thing I did was to create a Formula Field with the name
  <strong>NumberValorCif</strong> to convert the ICIF Value that I have to numeric with <strong>ToNumber ()</strong>. I saved this and created another formula field
  named <strong>SumCIFCredito</strong> that has the following code:</p>
  <pre><code>If {CobroPorcentaje.TipoDoc} = 'Credit Notes'
  then {@NumberValorCif}
  else 0
  </code></pre>
  <p>I saved, compiled and ran the application and it worked without any
  problems ... but. I wanted to do the same for <strong>SumCIFBoleta</strong>:</p>
  <pre><code>If {CobroPorcentaje.TipoDoc} = 'Ballot'
  then {@NumberValorCif}
  else 0
  </code></pre>
  <p>But I don't add anything. I'm missing something? or I have to create
  another variable.</p>
  <p>I hope someone can help me.</p>
  <p>Thank you so much</p>
  </blockquote>