title: Microsoft Power BI - DAX Time Intelligence measure - change context to reflect proper % change; non-YTD measures
body: <p>I have a Power BI visual as below. There are 3 matrices. I have a DateDimension (or) Calendar table called Dates2.</p>
  <p><a href="https://i.stack.imgur.com/2zP9F.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2zP9F.gif" alt="enter image description here" /></a></p>
  <p>I use two measures, one a regular measure (called 'Count'), the other a parallel period comparison of the measure (called 'Count_PreviousYear').   I use SAMEPERIODLASTYEAR DAX function for the latter.</p>
  <p>1)</p>
  <pre><code>Count = COUNTA(TableX[ColumnY])
  </code></pre>
  <p>--Measure with name 'Count'--</p>
  <p>2)</p>
  <pre><code>Count_PreviousYear = CALCULATE
    (
      [Count],
      SAMEPERIODLASTYEAR(Dates2[Date])
    )
  </code></pre>
  <p>--Measure with name 'Count_PreviousYear'</p>
  <p>--this measure uses Time Intelligence function - SAMEPERIODLASTYEAR--</p>
  <p>Both 'Count' and 'Count_PreviousYear' (obviously) are <strong>not</strong> YTD (YearToDate) values.</p>
  <p>A third measure for the percentage change across periods is computed as below:</p>
  <p>3)</p>
  <pre><code>PercentageChange = IF(
  
      ISBLANK([Count]) || ISBLANK([Count_PreviousYear]),
  
      BLANK(),
  
      (([Count] - [Count_PreviousYear])/[Count])
  
  )
  </code></pre>
  <p>Kindly ignore the fact that a keyword used as a measure name;
  I have used the name 'Count' only for clarity; in my actual report,
  I have proper names</p>
  <p>The % change measure works fine, but one issue:</p>
  <p>For the period change from 2020 to 2021, i.e. in the third row of the last matrix (for the row value 2021), the total (i.e. the % change value) is not appropriate.</p>
  <p>I need to replace -737.21% with - 23.98 %.</p>
  <p>This is because , I need to compute the Total for 2020, only by adding the values for the months of January and February, i.e. 428 + 430 = 858. (not 5794, which is for all the 12 months).</p>
  <p>Since 2021 has only two months - January and February, I don't want to compare two months of 2021, with all the 12 months of 2020. Rather, I want two months of 2021 to be compared with the corresponding 2 months of 2020.</p>
  <p><strong>Essentially I need {(692-858)/692} * 100 = -23.98%</strong></p>
  <p><strong>Currently, I see {(692-5794)/692} * 100 = -737.21%</strong></p>
  <p>Can someone help me achieve this?</p>