<?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: How do I group for a prior month and current month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4927879#M186946</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541485" data-lia-user-login="EaglesTony" class="lia-mention lia-mention-user"&gt;EaglesTony&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can do this in both &lt;STRONG&gt;Power BI (DAX)&lt;/STRONG&gt; and &lt;STRONG&gt;Microsoft Fabric (SQL)&lt;/STRONG&gt;. The logic is the same:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;For each month, take the &lt;STRONG&gt;latest record per Title&lt;/STRONG&gt; (using MAX or ROW_NUMBER()),&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Then &lt;STRONG&gt;sum the totals across Titles&lt;/STRONG&gt;.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;LatestPerTitle =
ADDCOLUMNS (
    SUMMARIZE (
        ApplicationMonthlySnapshot,
        ApplicationMonthlySnapshot[Title],
        FORMAT ( ApplicationMonthlySnapshot[ReportingDate], "MM/yyyy" )
    ),
    "MaxDate",
    CALCULATE (
        MAX ( ApplicationMonthlySnapshot[ReportingDate] )
    )
)

MonthlyTotals =
SUMMARIZE (
    FILTER (
        ApplicationMonthlySnapshot,
        ApplicationMonthlySnapshot[ReportingDate] IN VALUES ( LatestPerTitle[MaxDate] )
    ),
    FORMAT ( ApplicationMonthlySnapshot[ReportingDate], "MM/yyyy" ),
    "TotalA", SUM ( ApplicationMonthlySnapshot[TotalA] ),
    "TotalB", SUM ( ApplicationMonthlySnapshot[TotalB] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can then filter for EOMONTH(TODAY(), -1) (prior month) and EOMONTH(TODAY(), 0) (current month).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Microsoft Docs:&lt;BR /&gt;&lt;A title="SUMMARIZE (DAX)" href="https://learn.microsoft.com/en-us/dax/summarize-function-dax?utm_" target="_self"&gt;SUMMARIZE (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="CALCULATE (DAX)" href="https://learn.microsoft.com/en-us/dax/calculate-function-dax?utm_" target="_self"&gt;CALCULATE (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="Time intelligence functions (DAX)" href="https://learn.microsoft.com/en-us/dax/time-intelligence-functions-dax?utm_" target="_self"&gt;Time intelligence functions (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H3&gt;Microsoft Fabric (SQL)&lt;/H3&gt;&lt;P&gt;&lt;SPAN&gt;Using ROW_NUMBER():&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WITH LatestPerTitle AS (
    SELECT
        Title,
        FORMAT(ReportingDate, 'MM/yyyy') AS MonthYear,
        ReportingDate,
        TotalA,
        TotalB,
        ROW_NUMBER() OVER (
            PARTITION BY Title, FORMAT(ReportingDate, 'MM/yyyy')
            ORDER BY ReportingDate DESC
        ) AS rn
    FROM ApplicationMonthlySnapshot
)
SELECT
    MonthYear,
    SUM(TotalA) AS TotalA,
    SUM(TotalB) AS TotalB
FROM LatestPerTitle
WHERE rn = 1
  AND MonthYear IN (
        FORMAT(GETDATE(), 'MM/yyyy'),
        FORMAT(DATEADD(MONTH, -1, GETDATE()), 'MM/yyyy')
  )
GROUP BY MonthYear
ORDER BY MonthYear;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Or without window functions (JOIN + MAX):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WITH MaxDates AS (
    SELECT
        Title,
        FORMAT(ReportingDate, 'MM/yyyy') AS MonthYear,
        MAX(ReportingDate) AS MaxDate
    FROM ApplicationMonthlySnapshot
    GROUP BY Title, FORMAT(ReportingDate, 'MM/yyyy')
)
SELECT
    m.MonthYear,
    SUM(s.TotalA) AS TotalA,
    SUM(s.TotalB) AS TotalB
FROM MaxDates m
JOIN ApplicationMonthlySnapshot s
  ON s.Title = m.Title
 AND FORMAT(s.ReportingDate, 'MM/yyyy') = m.MonthYear
 AND s.ReportingDate = m.MaxDate
WHERE m.MonthYear IN (
        FORMAT(GETDATE(), 'MM/yyyy'),
        FORMAT(DATEADD(MONTH, -1, GETDATE()), 'MM/yyyy')
)
GROUP BY m.MonthYear
ORDER BY m.MonthYear;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Microsoft Docs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A title="FORMAT (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;FORMAT (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="DATEADD (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;DATEADD (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="ROW_NUMBER (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/row-number-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;ROW_NUMBER (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This produces exactly what you described:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;December 2025&lt;/STRONG&gt; → TotalA=6, TotalB=9&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;January 2026&lt;/STRONG&gt; → TotalA=8, TotalB=12&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&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;</description>
    <pubDate>Tue, 27 Jan 2026 07:00:49 GMT</pubDate>
    <dc:creator>Olufemi7</dc:creator>
    <dc:date>2026-01-27T07:00:49Z</dc:date>
    <item>
      <title>How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922614#M186846</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have the following data in a table called ApplicationMonthlySnapshot:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Title&amp;nbsp; &amp;nbsp;ReportingDate&amp;nbsp; &amp;nbsp;TotalA&amp;nbsp; &amp;nbsp; TotalB&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp;12/5/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp;12/22/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp;12/30/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; 12/5/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; 12/30/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/2/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/9/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/2/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/9/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need is based on the current date:&lt;/P&gt;&lt;P&gt;1) Get the prior month (12) and the max record for each Title and sum up the individual colums, so for 12/2026 I would get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ReportingDate&amp;nbsp; &amp;nbsp;TotalA&amp;nbsp; &amp;nbsp; TotalB&lt;/P&gt;&lt;P&gt;12/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is based on the following max records for the month:&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp;12/30/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; 12/30/2025&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) For the current month (01) and the max record for each Title and sum up the individual colums, so for 01/2026 I would get:&lt;/P&gt;&lt;P&gt;ReportingDate&amp;nbsp; &amp;nbsp;TotalA&amp;nbsp; &amp;nbsp; TotalB&lt;/P&gt;&lt;P&gt;01/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Title&amp;nbsp; &amp;nbsp;ReportingDate&amp;nbsp; &amp;nbsp;TotalA&amp;nbsp; &amp;nbsp; TotalB&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/9/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;/P&gt;&lt;P&gt;DEF&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/9/2026&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&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;</description>
      <pubDate>Wed, 21 Jan 2026 13:04:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922614#M186846</guid>
      <dc:creator>EaglesTony</dc:creator>
      <dc:date>2026-01-21T13:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922659#M186848</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541485" data-lia-user-login="EaglesTony" class="lia-mention lia-mention-user"&gt;EaglesTony&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if i fully get you, you can plot a table visual with data[reportingdate] column and two measures like below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MaxTotalA = 
VAR _date = MAX(data[ReportingDate])
VAR _table1 = 
FILTER(
    ALL(data), 
    data[ReportingDate]&amp;gt;=EDATE(_date, -12) 
        &amp;amp;&amp;amp; data[ReportingDate]&amp;lt;=_date
)
VAR _table2 =
ADDCOLUMNS(
    SUMMARIZE(_table1, data[Title]),
    "_MaxTotalA",
    CALCULATE(MAX(data[TotalA]))
)
VAR _result = SUMX(_table2, [_MaxTotalA])
RETURN _result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;MaxTotalB = 
VAR _date = MAX(data[ReportingDate])
VAR _table1 = 
FILTER(
    ALL(data), 
    data[ReportingDate]&amp;gt;=EDATE(_date, -12) 
        &amp;amp;&amp;amp; data[ReportingDate]&amp;lt;=_date
)
VAR _table2 =
ADDCOLUMNS(
    SUMMARIZE(_table1, data[Title]),
    "_MaxTotalB",
    CALCULATE(MAX(data[TotalB]))
)
VAR _result = SUMX(_table2, [_MaxTotalB])
RETURN _result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 14:53:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922659#M186848</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2026-01-21T14:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922999#M186860</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create the data model like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the DAX measure, I tried to use INDEX DAX function.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/index-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;INDEX function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum of MaxTotal: = 
VAR _currentmonth =
    EOMONTH ( TODAY (), 0 )
VAR _priormonth =
    EOMONTH ( _currentmonth, -1 )
RETURN
    SUMX (
        VALUES ( 'Calendar'[Month-Year] ),
        CALCULATE (
            CALCULATE (
                SUM ( 'Application'[Total] ),
                INDEX (
                    1,
                    SUMMARIZECOLUMNS (
                        'Calendar'[Date],
                        Title[Title],
                        FILTER (
                            'Calendar',
                            'Calendar'[Month-Year sort] &amp;lt;= _currentmonth
                                &amp;amp;&amp;amp; 'Calendar'[Month-Year sort] &amp;gt;= _priormonth
                        )
                    ),
                    ORDERBY ( CALCULATE ( SUM ( 'Application'[Total] ) ), DESC ),
                    ,
                    PARTITIONBY ( Title[Title] )
                )
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 04:02:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4922999#M186860</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2026-01-22T04:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4927657#M186936</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541485" data-lia-user-login="EaglesTony" class="lia-mention lia-mention-user"&gt;EaglesTony&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;for sharing valuable insights.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for being part of the Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;SPAN data-teams="true"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2026 04:43:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4927657#M186936</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2026-01-27T04:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4927879#M186946</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541485" data-lia-user-login="EaglesTony" class="lia-mention lia-mention-user"&gt;EaglesTony&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can do this in both &lt;STRONG&gt;Power BI (DAX)&lt;/STRONG&gt; and &lt;STRONG&gt;Microsoft Fabric (SQL)&lt;/STRONG&gt;. The logic is the same:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;For each month, take the &lt;STRONG&gt;latest record per Title&lt;/STRONG&gt; (using MAX or ROW_NUMBER()),&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Then &lt;STRONG&gt;sum the totals across Titles&lt;/STRONG&gt;.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;LatestPerTitle =
ADDCOLUMNS (
    SUMMARIZE (
        ApplicationMonthlySnapshot,
        ApplicationMonthlySnapshot[Title],
        FORMAT ( ApplicationMonthlySnapshot[ReportingDate], "MM/yyyy" )
    ),
    "MaxDate",
    CALCULATE (
        MAX ( ApplicationMonthlySnapshot[ReportingDate] )
    )
)

MonthlyTotals =
SUMMARIZE (
    FILTER (
        ApplicationMonthlySnapshot,
        ApplicationMonthlySnapshot[ReportingDate] IN VALUES ( LatestPerTitle[MaxDate] )
    ),
    FORMAT ( ApplicationMonthlySnapshot[ReportingDate], "MM/yyyy" ),
    "TotalA", SUM ( ApplicationMonthlySnapshot[TotalA] ),
    "TotalB", SUM ( ApplicationMonthlySnapshot[TotalB] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can then filter for EOMONTH(TODAY(), -1) (prior month) and EOMONTH(TODAY(), 0) (current month).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Microsoft Docs:&lt;BR /&gt;&lt;A title="SUMMARIZE (DAX)" href="https://learn.microsoft.com/en-us/dax/summarize-function-dax?utm_" target="_self"&gt;SUMMARIZE (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="CALCULATE (DAX)" href="https://learn.microsoft.com/en-us/dax/calculate-function-dax?utm_" target="_self"&gt;CALCULATE (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="Time intelligence functions (DAX)" href="https://learn.microsoft.com/en-us/dax/time-intelligence-functions-dax?utm_" target="_self"&gt;Time intelligence functions (DAX)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H3&gt;Microsoft Fabric (SQL)&lt;/H3&gt;&lt;P&gt;&lt;SPAN&gt;Using ROW_NUMBER():&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WITH LatestPerTitle AS (
    SELECT
        Title,
        FORMAT(ReportingDate, 'MM/yyyy') AS MonthYear,
        ReportingDate,
        TotalA,
        TotalB,
        ROW_NUMBER() OVER (
            PARTITION BY Title, FORMAT(ReportingDate, 'MM/yyyy')
            ORDER BY ReportingDate DESC
        ) AS rn
    FROM ApplicationMonthlySnapshot
)
SELECT
    MonthYear,
    SUM(TotalA) AS TotalA,
    SUM(TotalB) AS TotalB
FROM LatestPerTitle
WHERE rn = 1
  AND MonthYear IN (
        FORMAT(GETDATE(), 'MM/yyyy'),
        FORMAT(DATEADD(MONTH, -1, GETDATE()), 'MM/yyyy')
  )
GROUP BY MonthYear
ORDER BY MonthYear;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Or without window functions (JOIN + MAX):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WITH MaxDates AS (
    SELECT
        Title,
        FORMAT(ReportingDate, 'MM/yyyy') AS MonthYear,
        MAX(ReportingDate) AS MaxDate
    FROM ApplicationMonthlySnapshot
    GROUP BY Title, FORMAT(ReportingDate, 'MM/yyyy')
)
SELECT
    m.MonthYear,
    SUM(s.TotalA) AS TotalA,
    SUM(s.TotalB) AS TotalB
FROM MaxDates m
JOIN ApplicationMonthlySnapshot s
  ON s.Title = m.Title
 AND FORMAT(s.ReportingDate, 'MM/yyyy') = m.MonthYear
 AND s.ReportingDate = m.MaxDate
WHERE m.MonthYear IN (
        FORMAT(GETDATE(), 'MM/yyyy'),
        FORMAT(DATEADD(MONTH, -1, GETDATE()), 'MM/yyyy')
)
GROUP BY m.MonthYear
ORDER BY m.MonthYear;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Microsoft Docs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A title="FORMAT (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;FORMAT (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="DATEADD (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;DATEADD (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A title="ROW_NUMBER (Transact-SQL)" href="https://learn.microsoft.com/en-us/sql/t-sql/functions/row-number-transact-sql?view=sql-server-ver17&amp;amp;utm_" target="_self"&gt;ROW_NUMBER (Transact-SQL)&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This produces exactly what you described:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;December 2025&lt;/STRONG&gt; → TotalA=6, TotalB=9&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;January 2026&lt;/STRONG&gt; → TotalA=8, TotalB=12&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&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;</description>
      <pubDate>Tue, 27 Jan 2026 07:00:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4927879#M186946</guid>
      <dc:creator>Olufemi7</dc:creator>
      <dc:date>2026-01-27T07:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group for a prior month and current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4966611#M187026</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541485" data-lia-user-login="EaglesTony" class="lia-mention lia-mention-user"&gt;EaglesTony&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2026 10:40:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-group-for-a-prior-month-and-current-month/m-p/4966611#M187026</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2026-01-30T10:40:23Z</dc:date>
    </item>
  </channel>
</rss>

