title: Select cells based on certain dates
body: <p>I want to select the cells between a data range and calculate std deviation.</p>
  <p>I have table 1 (Historical share price) and table 2 (black scholes model). I have created a relationship between two tables.</p>
  <p>Table 1 will contain the date, closing price, and log (LN). A picture has been attached.<a href="https://i.stack.imgur.com/yaiLW.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>Table 2 will contain date and period between which the cells in table 1 closing price should be selected. A picture has been attached. <a href="https://i.stack.imgur.com/YkTQ8.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>In excel , i used the below formula to get the value</p>
  <pre><code>    STDEV.S(IF(('Historical share price'!$B$4:$B$3298&gt;=(EDATE('Black
   scholes'!$B5,-('Black scholes'!$C5*12)))*('Historical share
   price'!$B$4:$B$3298&lt;='Black scholes'!$B5)),'Historical share
   price'!$D$4:$D$3298,&quot;&quot;))*SQRT(252)
  </code></pre>
  <p>In Power bi, i'm not able to get the correct value as i have got in excel. Below is the</p>
  <pre><code>    Volatility = IF(((RELATED('Historical share price'[Date]))&gt;=
  ((EDATE('Black scholes model'[Date],-('Black scholes model'[Average expected
   life of the options]*12)))*((RELATED('Historical share price'[Date]))&lt;=
  ('Black scholes model'[Date])))),(RELATED('Historical share price'[Log])),0)
  </code></pre>