title: Counting records in another table that match criteria in PowerPivot
body: <p>I've got 2 tables:</p>
  
  <ol>
  <li><code>RefundData</code>: contains details of Refunds (relevant column name: <code>RefundAmount</code>)</li>
  <li><code>Buckets</code>: 3 columns: <code>BucketLow</code>, <code>BucketHigh</code>, <code>CountOfRecords</code></li>
  </ol>
  
  <p>The Refund Amounts range from $0.01 to $25,000.00.</p>
  
  <p>I'm trying to count the Refund amounts in the <code>RefundData</code> table that fall within each Bucket level in the <code>Buckets</code> table.</p>
  
  <p>Some sample data:</p>
  
  <pre><code>RefundAmount
  0.29
  81.75
  1000.25
  1500.74
  2154.55
  125.52
  
  BucketLow    BucketHigh    CountOfRecords
  0            1000          3
  1000         2000          2
  2000         3000          1 
  </code></pre>
  
  <p>What I've tried:</p>
  
  <p>In the <code>CountOfRecords</code> field I've tried adding the following expression to count the occurrences of <code>RefundAmount</code> that are >=<code>BucketLow' AND &lt;</code>BucketHigh`</p>
  
  <pre><code>=calculate(count('RefundData'[RefundAmount]),'RefundData'[RefundAmount]&gt;=[BucketLow],'RefundData'[RefundAmount]&lt;[BucketHigh])
  </code></pre>
  
  <p>PowerPivot is giving me the following error: </p>
  
  <p><strong>Column <code>BucketLow</code> cannot be found or may not be used in this expression.</strong></p>
  
  <p>What am I missing?</p>
  
  <p>I feel like I'm really close but missing something simple.</p>