title: How to obtain a nested average with Dax in Power BI?
body: <p>I am trying to calculate the average of a column in a measure in DAX, but I have the problem that the values are duplicated on multiple rows. </p>
  
  <p>The data looks like this:</p>
  
  <pre><code>Line  ID  Value
  1     1   10
  2     1   10
  3     1   10
  4     1   10
  5     1   10
  6     2   40
  7     2   40
  8     3   90
  9     3   90
  10    3   90
  </code></pre>
  
  <p>When I do</p>
  
  <p><code>sum(data[Value]) / countrows(data)</code></p>
  
  <p>the answer will be (50 + 80 + 270) / 10 = 40.</p>
  
  <p>However, I want the answer to be (10 + 40 + 90) / 3 = 46.7</p>
  
  <p>I know I have to divide by 3 and can achieve the 3 by</p>
  
  <p><code>distinctcount(data[ID])</code></p>
  
  <p>But I find it difficult to extract the 10, 40 and 90. </p>
  
  <p>Can you help me?</p>