title: Dynamic GROUPBY in DAX, PowerBI
body: <p>I'm new to PowerBI and DAX language.</p>
  
  <p>Considering the following table <code>All interactions</code> (which is a collection of user interaction with the system):
  <a href="https://i.stack.imgur.com/oJGut.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJGut.png" alt="enter image description here"></a></p>
  
  <p>I'd like to create the following visualization:
  <a href="https://i.stack.imgur.com/9AFMH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9AFMH.png" alt=""></a>
  (On the X-axis is total interactions count, on the Y-axis percentage of users in the system that has that number of interactions)</p>
  
  <p>This can be done by creating a dynamic table like:</p>
  
  <pre><code>TableFoo =
  GROUPBY (
      'All interactions',
      'All interactions'[user_name],
      "total_interactions", COUNTX ( CURRENTGROUP (), 'All interactions'[user_name] )
  )
  </code></pre>
  
  <p>Which can be visualized as expected:
  <a href="https://i.stack.imgur.com/tBBjj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tBBjj.png" alt="enter image description here"></a></p>
  
  <p>The problem with that <strong>I cannot filter the data dynamically</strong>. For example when trying to narrow down the results by selecting certain <code>type</code> or <code>user_details.gender</code> all the grouped data remains static.</p>
  
  <p>How can I approach that?</p>
  
  <p>Thanks.</p>