title: DAX calculated column - NEXTMONTH() value, shift row context
body: <p>I have successfully calculated <strong>&quot;WorkDaysPassed - Current Mo&quot;</strong>. This is a calculated column that counts the number of working days have passed in the month, only for the current month and the value is printed for each date record in the current month. Current month is ending '1/31/2022'.</p>
  <p>I need help figuring out how to print this same value on the prior months date records. Prior month is ending '12/31/2021'. The calculated column would be named <strong>&quot;WorkDaysPassed - Closing Month&quot;</strong>. I think the <code>NEXTMONTH()</code> calculation could do this in in aggregate function.</p>
  <p>How to do this in a calculated column? Below is what I have tried to calculate so far.</p>
  <h1>Correct calculation</h1>
  <ol>
  <li>This is a calculated column that counts the number of working days have passed in the month, only for the current month and the value is printed for each date record in the current month.</li>
  </ol>
  <pre><code>WorkDaysPassed - Current Mo = 
  IF( NOT('Calendar'[IsCurrentMonth]), BLANK(), 
  CALCULATE(
      COUNTROWS ( 'Calendar' ),
      'Calendar'[Date],
      'Calendar'[IsWorkingDay] = TRUE 
      &amp;&amp; 'Calendar'[Date] &lt;= TODAY ()
      &amp;&amp; MONTH('Calendar'[Date]) = MONTH(TODAY())
      &amp;&amp; YEAR('Calendar'[Date]) = YEAR(TODAY())
  ))
  </code></pre>
  <h1>Attempted calculations</h1>
  <ol>
  <li>It is printing 186 for every row in the date table.</li>
  </ol>
  <pre><code>WorkDaysPassed - Closing Month = 
  CALCULATE(SUM('Calendar'[WorkDaysPassed - Current Mo]), ALL('Calendar') ) 
  </code></pre>
  <hr />
  <h1>Table data sample</h1>
  <p><a href="https://i.stack.imgur.com/iWIVG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iWIVG.png" alt="enter image description here" /></a></p>