title: Calculate "Down factor" for each row using DAX in Power BI
body: <p>I have the following format of data:</p>
  
  <pre><code>Machine | Production | Production Factor | Down Factor | Order
  --------|------------|-------------------|-------------|------
  M1      | 0          | 0                 | 0           | 100
  M2      | 187370     | 0                 | 0           | 115
  M3      | 7054       | 0                 | 0           | 130
  M4      | 39428      | 1                 | 24160       | 150
  M5      | 6945       | 0                 | 0           | 160
  M6      | 0          | 1                 | 24160       | 181
  M7      | 19720      | 1                 | 4440        | 200
  M8      | 4440       | 1                 | 0           | 220
  M9      | 30000      | 0                 | 0           | 230
  M10     | 20000      | 0                 | 0           | 240
  </code></pre>
  
  <p>Machine, Production, Production Factor and Order fields are extracted from database
  I need to calculate "Down Factor" for every machine based on the formula in scope of ascending Order field:</p>
  
  <pre><code>Down Factor =
      SUM ( Production * Production Factor * IF(CurrentRowOrder &gt; RowOrder THEN 1 ELSE 0 ) )
  </code></pre>
  
  <p>As for example M4 (<b>CurrentRowOrder = 150</b>):</p>
  
  <pre><code> 6945 * 0 * 1 (160 &gt; 150) +
      0 * 1 * 1 (181 &gt; 150) +
  19720 * 1 * 1 (200 &gt; 150) +
   4400 * 1 * 1 (220 &gt; 150) +
  30000 * 0 * 1 (230 &gt; 150) +
  20000 * 0 * 1 (240 &gt; 150) = 24160
  </code></pre>
  
  <p>M7: (<b>CurrentRowOrder = 200</b>):</p>
  
  <pre><code> 4400 * 1 * 1 (220 &gt; 200) +
  30000 * 0 * 1 (230 &gt; 200) +
  20000 * 0 * 1 (240 &gt; 200) = 4400
  </code></pre>
  
  <p>The general idea of calculation "Down Factor" using such approach, is to include rows, which Order is greater than Order of calculated row.</p>
  
  <p>How can I perform such calculation in DAX? Can you help with some queries?</p>