title: Creating a calculated table by passing a measure or parameter
body: <p>I have a requirement where I have a data like this,</p>
  
  <pre><code>Date      Name  Age 
  1-1-2018  A     1
  2-2-2018  B     1
  3-3-2018  B     1
  6-6-2018  C     2
  7-7-2018  B     6
  </code></pre>
  
  <p>I am trying to give a slicer to the user to select the required number of months from the last month.</p>
  
  <p>So to do that, I am using a calculated column like this:</p>
  
  <pre><code>Month Year = DATEDIFF((Table1[Date]), TODAY(), MONTH) + 1
  </code></pre>
  
  <p>So that changes the data to something like this:</p>
  
  <pre><code>Date      Name  Age  MonthYear
  1-1-2018  A     1    7
  2-2-2018  B     1    6
  3-3-2018  B     1    5
  6-6-2018  C     2    2
  7-7-2018  B     6    1
  </code></pre>
  
  <p>The user selects the Month Year from the Slicer.</p>
  
  <p>For example, when he selects 2, I want to display the last 2 months records in the table.</p>
  
  <p>Expected Output:</p>
  
  <pre><code>Date      Name  Age  
  6-6-2018  C     2   
  7-7-2018  B     6   
  </code></pre>
  
  <p>This works for me if I hardcode it like this:</p>
  
  <pre><code>Calculated Table = CALCULATETABLE(Table1,
                         FILTER(Table1, OR(Table1[MonthYear] &gt; 2, Table1[MonthYear] = 2)))
  </code></pre>
  
  <p>But it fails when I try to pass the value in the place of 2 dynamically through a measure using <code>SelectedValue</code> function.</p>