<?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 Assistance Needed: Creating Year-Month Columns and Sum in Power BI in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4087831#M162248</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having difficulty creating columns (or maybe a measure) in Power BI.&lt;/P&gt;&lt;P&gt;I have a dataset with Unique UserName and Terminated Date.&lt;/P&gt;&lt;P&gt;I want to create a table that has a Year-Month column and counts the number of terminated people in that Year-Month.&lt;/P&gt;&lt;P&gt;Additionally, I want to build a column that sums the terminated counts for the last 12 months. For example, if the month is May 2024, I want to count the number of terminations from May 2023 to May 2024.&lt;/P&gt;&lt;P&gt;I want to do this for all months. For instance, if the month is June 2024, I want to count the terminations from June 2023 to June 2024.&lt;/P&gt;&lt;P&gt;Can you please help me with a way to build this column?&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 22:36:44 GMT</pubDate>
    <dc:creator>hsp1992</dc:creator>
    <dc:date>2024-08-07T22:36:44Z</dc:date>
    <item>
      <title>Assistance Needed: Creating Year-Month Columns and Sum in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4087831#M162248</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having difficulty creating columns (or maybe a measure) in Power BI.&lt;/P&gt;&lt;P&gt;I have a dataset with Unique UserName and Terminated Date.&lt;/P&gt;&lt;P&gt;I want to create a table that has a Year-Month column and counts the number of terminated people in that Year-Month.&lt;/P&gt;&lt;P&gt;Additionally, I want to build a column that sums the terminated counts for the last 12 months. For example, if the month is May 2024, I want to count the number of terminations from May 2023 to May 2024.&lt;/P&gt;&lt;P&gt;I want to do this for all months. For instance, if the month is June 2024, I want to count the terminations from June 2023 to June 2024.&lt;/P&gt;&lt;P&gt;Can you please help me with a way to build this column?&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 22:36:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4087831#M162248</guid>
      <dc:creator>hsp1992</dc:creator>
      <dc:date>2024-08-07T22:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance Needed: Creating Year-Month Columns and Sum in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4087982#M162254</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="787978" data-lia-user-login="hsp1992" class="lia-mention lia-mention-user"&gt;hsp1992&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created these example data.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1. create measure to calculate the count for the last 12 months.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
VAR _start =
EOMONTH ( MAX ( 'Table'[Terminated Date] ), 0 )
VAR _end =
EOMONTH ( MAX ( 'Table'[Terminated Date] ), -13 ) + 1
RETURN
CALCULATE (
COUNT ( 'Table'[Unique UserName] ),
FILTER (
ALL ( 'Table' ), FILTER (
'Table'[Terminated Date] &amp;lt;= _start
&amp;amp;&amp;amp; 'Table'[Terminated Date] &amp;gt;= _end
)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Put the appropriate fields in the table visual object. The date column retains the year and month hierarchy, and the summarise method for username selects count.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 01:38:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4087982#M162254</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-08T01:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance Needed: Creating Year-Month Columns and Sum in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4089982#M162332</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;First of all, thank you so much for helping me with this. Your assistance has really helped me to resolve the issue.&lt;/P&gt;&lt;P&gt;Here is the image of the data that I have right now. What I want to do is add the value of the past 12 months. And I have the Expected Value in the below image.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example:&lt;/P&gt;&lt;P&gt;For August 2024, I should have a value of 45 because it includes the sum of the values from August 2023 to August 2024. Another example, for January 2024, I should have a value of 44.&lt;/P&gt;&lt;P&gt;Can you help me to add the values based on the past 12 months?&lt;/P&gt;&lt;P&gt;Thank you so much for all your help.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 20:04:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4089982#M162332</guid>
      <dc:creator>hsp1992</dc:creator>
      <dc:date>2024-08-08T20:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance Needed: Creating Year-Month Columns and Sum in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4090000#M162334</link>
      <description>&lt;P&gt;I think I resolved it with below query&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rolling12MonthTerminationCount =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;CurrentYearMonth&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MonthlyTerminatedEmployees&lt;/SPAN&gt;&lt;SPAN&gt;[YearMonthSort]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;CurrentDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt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&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MonthlyTerminatedEmployees&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MonthlyTerminatedEmployees&lt;/SPAN&gt;&lt;SPAN&gt;[YearMonthSort]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;StartDate&lt;/SPAN&gt;&lt;SPAN&gt;) * &lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;StartDate&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MonthlyTerminatedEmployees&lt;/SPAN&gt;&lt;SPAN&gt;[YearMonthSort]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;CurrentYearMonth&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Thank you so much!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Aug 2024 20:08:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-Needed-Creating-Year-Month-Columns-and-Sum-in-Power/m-p/4090000#M162334</guid>
      <dc:creator>hsp1992</dc:creator>
      <dc:date>2024-08-08T20:08:37Z</dc:date>
    </item>
  </channel>
</rss>

