<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DAX | Annualized Attrition Calculation per Month and by Year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4627122#M177137</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how it returns the desired value:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Months_completed should return as&lt;/P&gt;&lt;P&gt;December = 12&lt;/P&gt;&lt;P&gt;January = 1&lt;/P&gt;&lt;P&gt;February = 2&lt;/P&gt;&lt;P&gt;2024 = 12&lt;/P&gt;&lt;P&gt;2025 = 2&lt;/P&gt;</description>
    <pubDate>Thu, 27 Mar 2025 09:11:54 GMT</pubDate>
    <dc:creator>ExodusB</dc:creator>
    <dc:date>2025-03-27T09:11:54Z</dc:date>
    <item>
      <title>DAX | Annualized Attrition Calculation per Month and by Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626718#M177116</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Annualized Attrition Calculation per Month and by Year&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Monday&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Need help! I am stuck with my Annualized formula and cannot return the correct number of months completed for each year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Formula for Annualized Attrition should be (Total Attrition / Headcount) / Number of Months completed *Total Number of Months in a year, therefore I am needing help to get the Annualized Attrition values same as below:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, my formula counts all the number of months in my data regardless of which year. I need to have a separate month count for 2024 and 2025 (possibly even for years 2022 until 2023)&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Mar 2025 02:36:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626718#M177116</guid>
      <dc:creator>ExodusB</dc:creator>
      <dc:date>2025-03-27T02:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: DAX | Annualized Attrition Calculation per Month and by Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626891#M177125</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1244292" data-lia-user-login="ExodusB" class="lia-mention lia-mention-user"&gt;ExodusB&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Your issue is that your DAX formula for Annualized Attrition is not correctly calculating the Number of Months Completed per year. Instead, it is counting all months in the dataset.&lt;/P&gt;
&lt;P&gt;Try below:&lt;BR /&gt;Modify your Number of Months Completed calculation to count only distinct months per year.&lt;/P&gt;
&lt;P&gt;Step 1: Create a measure for counting distinct months per year&lt;BR /&gt;DAX&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Months_Completed =
VAR CurrentYear = SELECTEDVALUE('Table'[Year])
RETURN
CALCULATE(
DISTINCTCOUNT('Table'[Month]),
'Table'[Year] = CurrentYear
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Step 2: Update your Annualized Attrition Measure&lt;BR /&gt;DAX&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Annualized_Attrition =
VAR TotalAttrition = SUM('Table'[Total Attrition])
VAR AvgHeadcount = AVERAGE('Table'[Average Head Count])
VAR MonthsCompleted = [Months_Completed]
VAR TotalMonths = 12

RETURN
IF(
MonthsCompleted &amp;gt; 0,
(TotalAttrition / AvgHeadcount) / MonthsCompleted * TotalMonths,
BLANK()
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark this post as&amp;nbsp; solution if it helps you. Appreciate Kudos.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 06:35:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626891#M177125</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2025-03-27T06:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: DAX | Annualized Attrition Calculation per Month and by Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626982#M177129</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp;your response is truly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't have a PowerBI model yet and am still working this in Excel query so some functions such as SELECTEDVALUE isn't working. Is the MAX function an alternative function or would you recommend me&amp;nbsp; reposting this to Power Query forum?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 07:54:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4626982#M177129</guid>
      <dc:creator>ExodusB</dc:creator>
      <dc:date>2025-03-27T07:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: DAX | Annualized Attrition Calculation per Month and by Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4627100#M177135</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1244292" data-lia-user-login="ExodusB" class="lia-mention lia-mention-user"&gt;ExodusB&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Yes, since you're working in Excel (likely using Power Query or Pivot Tables), some DAX functions like SELECTEDVALUE won't work. However, you can replace it with MAX, VALUES, or FILTER depending on your setup.&lt;/P&gt;
&lt;P&gt;Alternative approach using Excel formulas or Power Query:&lt;BR /&gt;Option 1: Using Power Pivot (DAX in Excel)&lt;BR /&gt;If you're using Power Pivot in Excel, you can modify the DAX measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Months_Completed =
VAR CurrentYear = MAX('Table'[Year])
RETURN
CALCULATE(
DISTINCTCOUNT('Table'[Month]),
'Table'[Year] = CurrentYear
)&lt;/LI-CODE&gt;
&lt;P&gt;This replaces SELECTEDVALUE with MAX, which works well when used in a Pivot Table context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option 2: Using Power Query (M Language)&lt;BR /&gt;If you're working in Power Query, you can calculate the distinct month count per year using Group By:&lt;/P&gt;
&lt;P&gt;Go to Power Query Editor&lt;/P&gt;
&lt;P&gt;Select the Year column&lt;/P&gt;
&lt;P&gt;Click Group By → Set it to count distinct Month values per Year&lt;/P&gt;
&lt;P&gt;Merge this back into your main table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option 3: Using Excel Formulas&lt;BR /&gt;If your data is in Excel without Power Query, you can use SUMIFS to count distinct months per year:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;=SUM(IF(FREQUENCY(IF(A2:A100=YearCell, B2:B100), B2:B100) &amp;gt; 0, 1))&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;A2:A100 = Year column&lt;/P&gt;
&lt;P&gt;B2:B100 = Month column&lt;/P&gt;
&lt;P&gt;YearCell = Reference to the year you are checking&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark this post as solution if it helps you. Appreciate Kudos.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 08:58:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4627100#M177135</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2025-03-27T08:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: DAX | Annualized Attrition Calculation per Month and by Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4627122#M177137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="833383" data-lia-user-login="FarhanJeelani" class="lia-mention lia-mention-user"&gt;FarhanJeelani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how it returns the desired value:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Months_completed should return as&lt;/P&gt;&lt;P&gt;December = 12&lt;/P&gt;&lt;P&gt;January = 1&lt;/P&gt;&lt;P&gt;February = 2&lt;/P&gt;&lt;P&gt;2024 = 12&lt;/P&gt;&lt;P&gt;2025 = 2&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 09:11:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Annualized-Attrition-Calculation-per-Month-and-by-Year/m-p/4627122#M177137</guid>
      <dc:creator>ExodusB</dc:creator>
      <dc:date>2025-03-27T09:11:54Z</dc:date>
    </item>
  </channel>
</rss>

