<?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: Adding A calculated Column to Determine the Last Month of the Year in Which a Sale Occurs in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Adding-A-calculated-Column-to-Determine-the-Last-Month-of-the/m-p/4368103#M144635</link>
    <description>&lt;P&gt;You may be able to use something like this...&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Calculated Column&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last Month = 
var _cust = 
'Table'[Customer]
Return
MAXX(
    FILTER(ALL('Table'), [Customer] = _cust),
    'Table'[Month]
)&lt;/LI-CODE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 21:47:31 GMT</pubDate>
    <dc:creator>jgeddes</dc:creator>
    <dc:date>2025-01-16T21:47:31Z</dc:date>
    <item>
      <title>Adding A calculated Column to Determine the Last Month of the Year in Which a Sale Occurs</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Adding-A-calculated-Column-to-Determine-the-Last-Month-of-the/m-p/4367908#M144629</link>
      <description>&lt;P&gt;I have annual sales data pulled into an Excel Power Pivot and connected to a date table that includes a serial number for each month of the year (to eliminate the need for date math).&amp;nbsp; Data includes a line for each sale to a customer over the course of the year, which can mean more than one line per customer in a given month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each customer, I need to determine the last month during the year in which a customer made a purchase.&amp;nbsp; I'm currently using the following formula:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--    StartFragment     --&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;MAXX&lt;/SPAN&gt;&lt;SPAN class=""&gt;( &lt;/SPAN&gt;&lt;SPAN class=""&gt;FILTER&lt;/SPAN&gt;&lt;SPAN class=""&gt;( &lt;/SPAN&gt;&lt;SPAN class=""&gt;ALL&lt;/SPAN&gt;&lt;SPAN class=""&gt;(SalesTable), &lt;/SPAN&gt;&lt;SPAN class=""&gt;SalesTable[Customer] = Earlier(SalesTable[Customer] ,&lt;/SPAN&gt;&lt;SPAN class=""&gt;SalesTable[MoSerialNo])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;NOTE:&amp;nbsp; there are other fields involved like product type that use the same&amp;nbsp;&lt;EM&gt;parameter = earlier(parameter)&amp;nbsp;&lt;/EM&gt;form.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;For customers with only one purchase in a month, this always produces the correct results.&amp;nbsp; But for customers with more than one purchase in a month, it produces two answers; the month in which the sale occurs and the last month in which a sale occurs.&amp;nbsp; This creates issues in extracting the data as there should be a single value for the last month in which a customer makes a purchase.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;How can I either modify this formula, use another function, or create another field that will produce one answer (the maximum month serial number) for all instances of a customer that are in the sales data?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;!--    EndFragment     --&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 21:32:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Adding-A-calculated-Column-to-Determine-the-Last-Month-of-the/m-p/4367908#M144629</guid>
      <dc:creator>JlmillerRedmond</dc:creator>
      <dc:date>2025-01-16T21:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding A calculated Column to Determine the Last Month of the Year in Which a Sale Occurs</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Adding-A-calculated-Column-to-Determine-the-Last-Month-of-the/m-p/4368103#M144635</link>
      <description>&lt;P&gt;You may be able to use something like this...&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Calculated Column&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last Month = 
var _cust = 
'Table'[Customer]
Return
MAXX(
    FILTER(ALL('Table'), [Customer] = _cust),
    'Table'[Month]
)&lt;/LI-CODE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 21:47:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Adding-A-calculated-Column-to-Determine-the-Last-Month-of-the/m-p/4368103#M144635</guid>
      <dc:creator>jgeddes</dc:creator>
      <dc:date>2025-01-16T21:47:31Z</dc:date>
    </item>
  </channel>
</rss>

