title: Conditional sum in Tableau
body: <p>I am just starting out with Tableau and have a question.</p>
  
  <p>I have a star schema data warehouse with a fact table containing an "Amount", joined to a dimension containing "Event types"</p>
  
  <p>Two event Types are "Settled" and "Cancelled"</p>
  
  <p>I want to create a calculated measure in Tableau "Net Amount" which is the difference between the sum of Settled and Cancelled.</p>
  
  <p>How do I do that?</p>
  
  <p>I tried </p>
  
  <p><code>SUM(IIF(Event_type_name = "Settled",Amount,0))-SUM(IIF(Event_type_name = "Cancelled",Amount,0))</code> </p>
  
  <p>but it returns a blank string</p>