title: Dynamic filtering based on selected value in slicer in Power BI
body: <p>I am trying to create a calculated table where the data is being taken from another table and calculating the average based on the username, total average and variance between the 2 of these columns.</p>
  <p>To create a table, I used the below DAX in Power BI which calculated the average based on the username.</p>
  <pre><code>scanner_speed_average_calculation = 
      SUMMARIZE(scanner_speed
          ,scanner_speed[user_name]
          ,&quot;Average&quot;
          ,AVERAGE(scanner_speed[order_processed]))
  </code></pre>
  <p>To calculate the group_average I used the below DAX:</p>
  <pre><code>group_average = 
      SUMMARIZE(
          scanner_speed
          , &quot;Group Avg&quot;
          , average(scanner_speed[order_processed]))
  </code></pre>
  <p>And finally to calculate the variance, I used this query:</p>
  <pre><code>Variance = scanner_speed_average_calculation[Average] - scanner_speed_average_calculation[group_average]
  </code></pre>
  <p>Below is an outcome of these calculations.</p>
  <p><a href="https://i.stack.imgur.com/joXsI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/joXsI.jpg" alt="enter image description here" /></a></p>
  <p>I want to be able to make these calculations dynamic based on the selected value from the date. The table where I am taking these calculations do have the date value. I want to be able to use date range in slicer and I want these values to change based on the selected date range. I tried few things with Filter, Selectedvalue but I am not sure if I used them correctly.</p>
  <p>Below is a main table where I took all these calculations from.</p>
  <p><a href="https://i.stack.imgur.com/uzyjd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uzyjd.jpg" alt="enter image description here" /></a></p>
  <p>Below is a visual of where I want to group_average and variance. I want to be able to use date range and these columns should change accordingly.</p>
  <p><a href="https://i.stack.imgur.com/YyQt3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YyQt3.jpg" alt="enter image description here" /></a></p>
  <p>Any idea or help will be appreciated. If possible then please put the entire formula. I am still a newbie in the world of DAX. Thanks in advance</p>
  <p><a href="https://drive.google.com/file/d/16rzUDNSxhwwOaxlBVwyrBiUO-CHK_HqX/view?usp=sharing" rel="nofollow noreferrer">power bi file</a></p>