title: Calculate the number of students enrolled and finished within each month
body: <p>I am trying to produce a cluster column chart with Month/Year as the x-axis and the number of enrolled and finished students within each month as y-axis, which would look like this (<strong>navy: enrolled students, red: finished students; A: April, B: May, etc</strong>):</p>
  <img src="https://i.stack.imgur.com/1GK9Q.png" width="500">
  <p>In EXCEL, what I want to do would be simply put as:<br />
  <strong><code>Number of Enrolled = COUNTIFS('Student Enrolment Date', '&gt;=01/04/2021', 'Student Enrolment Date', '&lt;=01/04/2021')</code></strong><br />
  <strong><code>Number of Completed = COUNTIFS('Student Finish Date', '&gt;=01/04/2021', 'Student Finish Date', '&lt;=01/04/2021')</code></strong></p>
  <p>Then use the calculated values to produce a visual.</p>
  <p>The data example (let's call it <strong>Student</strong>) is as below:</p>
  <p><a href="https://i.stack.imgur.com/jQwND.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jQwND.png" alt="enter image description here" /></a></p>
  <p>I have also produced a date dimension as below:</p>
  <p><a href="https://i.stack.imgur.com/99lnn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/99lnn.png" alt="enter image description here" /></a></p>
  <p>I get confused about how to do this using DAX. If I connect Student['course start date'] with Date['Date'], and use Date['Year-Month'] as x-axis as below, then Power BI will count all students whose Student['course start date'] fall into each month. But because students is not necessarily get enrolled and finished in the same month, this method is apparently incorrect.</p>
  <p><a href="https://i.stack.imgur.com/QqVRr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QqVRr.png" alt="enter image description here" /></a></p>
  <p><strong>My questions are</strong>:</p>
  <ul>
  <li>I am now trying to count the date in Student['student enrolment date'] and Student['student finish date'] within each month using:</li>
  </ul>
  <p><strong>Student Complete = COUNTROWS(FILTER(Student, Student[Status]=&quot;Complete&quot; &amp;&amp; Student[student enrolment date]&gt;=DATE(2021, 4, 1) &amp;&amp; Student[student enrolment date]&lt;=DATE(2021, 4, 30) + 0))</strong></p>
  <p>but DAX says this is not a correct formula, and I don't know how to make this formula calculate for each month. Could you please correct me?</p>
  <ul>
  <li>In my case, how to properly connect the date dimension to the Student dimension?</li>
  </ul>