title: Based on slicer selection create dynamic calculated table in Power BI
body: <p>I’m new to Power BI. Currently facing similar issue explained below in my product development.</p>
  
  <p>I have created power bi modle with below dimensions and facts from adventureworksDW.</p>
  
  <p><a href="https://i.stack.imgur.com/vd3GK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vd3GK.png" alt="enter image description here"></a></p>
  
  <p>Then I created a calculated table, which gives result as sum of sales group by ProductSubCategory and ProductCategory. Below is the DAX for the calculated table.</p>
  
  <p><a href="https://i.stack.imgur.com/xFKPN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xFKPN.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/E0OmX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E0OmX.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/HO5HF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HO5HF.png" alt="enter image description here"></a></p>
  
  <p>Now I want to create a new calculated table, which gives me TOPn ProductSubCategory based on the Total sales amount.
  Below is the DAX to do this.</p>
  
  <p><a href="https://i.stack.imgur.com/013RL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/013RL.png" alt="enter image description here"></a></p>
  
  <p>and model relationships looks like below.</p>
  
  <p><a href="https://i.stack.imgur.com/NrdsR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NrdsR.png" alt="enter image description here"></a></p>
  
  <p>I want this TOPn rows to be displayed based on filter condition on product category. Something like below.</p>
  
  <p><a href="https://i.stack.imgur.com/6ivOA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ivOA.png" alt="enter image description here"></a></p>
  
  <p>This works fine when I hardcode the product category value in the DAX itself. But if I want to change this product category values from the slicer selection, then I didn’t get any results.</p>
  
  <p><a href="https://i.stack.imgur.com/SJYO7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SJYO7.png" alt="enter image description here"></a></p>