title: Row sum with condition in SQL Server
body: <p>I am trying to create a row sum in SQL, but have somewhat complicated logic. for example, I am trying to create a logic with the following table so that</p>
  
  <ul>
  <li>If A >0 and B > 1, then the sum = A + 2* C + D </li>
  <li>else if A = 0 and B >    1,  then the sum = B + D</li>
  <li>else if A = 0 and B &lt;= 1, then the sum = B +    C</li>
  <li>else if A >0 and B &lt;= 1, then the sum = 2*A + B + C + D</li>
  </ul>
  
  <p>What's the best way to create a logic like this in SQL Server?</p>
  
  <p>Thank you!</p>
  
  <p><a href="https://i.stack.imgur.com/Xcolg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xcolg.png" alt="enter image description here"></a></p>