<?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: Summarizing a table to align most recent dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3939906#M153181</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;&amp;nbsp;THANK YOU!&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 13:17:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-22T13:17:48Z</dc:date>
    <item>
      <title>Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3909427#M152260</link>
      <description>&lt;P&gt;I've been unable to find/figure out how to summarize a table such that the data is aligned by most recent month, prior month, prior month -1, etc.&amp;nbsp; My goal is to be able to select the primary source based on qty for each branch based on the most recent 3 months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the following data&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Data Table&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Branch&lt;/TD&gt;&lt;TD&gt;source&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;month&lt;/TD&gt;&lt;TD&gt;qty&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;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TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East&lt;/TD&gt;&lt;TD&gt;C Vendor&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Sep-23&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East&lt;/TD&gt;&lt;TD&gt;A Vendor&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Jul-23&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East&lt;/TD&gt;&lt;TD&gt;C Vendor&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Feb-24&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would Pivot to look like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If I can create a table from the above that looks like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I can then select the most recent 3 months, and the result would look like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any and all help would be appreciated!&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:19:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3909427#M152260</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-10T15:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3909541#M152264</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use below measure to&amp;nbsp;&lt;SPAN&gt;achieve.&amp;nbsp;&lt;/SPAN&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;LI-CODE lang="markup"&gt;Primary Source = 
IF(HASONEFILTER('Fact'[Branch]),
    VAR tempTable = 
        ADDCOLUMNS(
            VALUES('Fact'[source]),
            "Recent3MonthsTotal",
                CALCULATE(
                    SUMX(
                        TOPN(3,'Fact','Fact'[new month]),
                        'Fact'[qty]
                    )
                )
        )
    VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal])
    RETURN
    MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The key step is to convert the months into a sortable format, such as dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I answer your question? If yes, pls mark my post as a solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 16:13:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3909541#M152264</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-05-10T16:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3917594#M152486</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;Thank you -- I'll check this out asap!&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 14:04:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3917594#M152486</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-14T14:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3918953#M152544</link>
      <description>&lt;P&gt;Your solutions is&amp;nbsp;great&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Have you solved your problem? If so, can you share your solution here or mark the correct answer as a standard answer to help other members find it faster. Thank you very much for your kind cooperation!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 03:03:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3918953#M152544</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-15T03:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3921610#M152634</link>
      <description>&lt;P&gt;Thanks for taking the time to work on this.&amp;nbsp; This isn't working exactly as expected.&amp;nbsp; When I add the following additional rows of data (identified as "West",&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I get the following result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;you can see that the output is not what you would expect based on the most recent 3 transactions for West.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I need to be able to have this data in a table to use in other relationships and export to other users, the Measure is nice but doesn't do everything I need.&amp;nbsp; Thanks again for your efforts!&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 19:32:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3921610#M152634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-15T19:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3921962#M152642</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I know what the correct result is for the branch "West"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Isn't the calculation logic to calculate the qty of the last three transactions by branch and source, and then take the source with the highest total qty?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And, if you want to create a table instead of using a matrix, then you can use the following expression for creating a table:&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;Table Name = 
ADDCOLUMNS (
    ALL ( 'Fact'[Branch] ),
    "Parimay Source",
        CALCULATE (
            VAR tempTable =
                ADDCOLUMNS (
                    VALUES ( 'Fact'[source] ),
                    "Recent3MonthsTotal", 
                        CALCULATE ( 
                            SUMX ( 
                                TOPN ( 3, 'Fact', 'Fact'[new month] ), 
                                'Fact'[qty] 
                            ) 
                        )
                )
            VAR MaxNbr =
                MAXX ( tempTable, [Recent3MonthsTotal] )
            RETURN
                MAXX ( FILTER ( tempTable, [Recent3MonthsTotal] = MaxNbr ), 'Fact'[source] )
        )
)
&lt;/LI-CODE&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;Did I answer your question? If yes, pls mark my post as a solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 01:47:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3921962#M152642</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-05-16T01:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3924237#M152694</link>
      <description>&lt;P&gt;Sorry if I wasn't clear.&amp;nbsp; The point is to use only the last 3 transactions by date, then determine the primary source.&amp;nbsp; For West, the primary source would be "D vendor". (I left the initial date col blank since you didn't need that).&amp;nbsp; Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 12:58:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3924237#M152694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-16T12:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936306#M153091</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;I hope the above clarifies the question.&amp;nbsp; If not, please let me know.&amp;nbsp; Thank you!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 14:20:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936306#M153091</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-21T14:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936450#M153096</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to define "last 3 transactions", where month is not empty, and then take the last three?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If yes, you can refer to below measure or table expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#1 Measure:&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;Primary Source = 
IF(HASONEFILTER('Fact'[Branch]),
    VAR tempTable = 
        ADDCOLUMNS(
            VALUES('Fact'[source ]),
            "Recent3MonthsTotal",
                CALCULATE(
                    SUMX(
                        TOPN(3,'Fact','Fact'[month]),
                        'Fact'[qty]
                    ),
                    'Fact'[month]&amp;lt;&amp;gt;BLANK()
                )
        )
    VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal])
    RETURN
    MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source ])
)&lt;/LI-CODE&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;#2 Table:&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;Table Name = 
ADDCOLUMNS (
    ALL ( 'Fact'[Branch] ),
    "Parimay Source",
        CALCULATE (
            VAR tempTable =
                ADDCOLUMNS (
                    VALUES ( 'Fact'[source ] ),
                    "Recent3MonthsTotal", 
                        CALCULATE ( 
                            SUMX ( 
                                TOPN ( 3, 'Fact', 'Fact'[month] ), 
                                'Fact'[qty] 
                            ),
                            'Fact'[month]&amp;lt;&amp;gt;BLANK()
                        )
                )
            VAR MaxNbr =
                MAXX ( tempTable, [Recent3MonthsTotal] )
            RETURN
                MAXX ( FILTER ( tempTable, [Recent3MonthsTotal] = MaxNbr ), 'Fact'[source ] )
        )
)&lt;/LI-CODE&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;&lt;A href="https://1drv.ms/u/s!Avkq2QNvDlkrwT1gxRSieX7LfynS?e=50hxW5" target="_blank" rel="noopener"&gt;Demo - Summarizing a table to align most recent dates.pbix&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I answer your question? If yes, pls mark my post as a solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 15:20:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936450#M153096</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-05-21T15:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936965#M153106</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I updated the date information in the Fact table to reflect actual dates as you originally suggested:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In a visual, it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;From the above table, you can see that for the latest 3 transactions:&lt;/P&gt;&lt;P&gt;East (5 - A, 6 - B and 8 - C) yields C vendor&lt;/P&gt;&lt;P&gt;North ( 7+4 + 3= 14)&amp;nbsp;yields B vendor&amp;nbsp;&lt;/P&gt;&lt;P&gt;South ( (8+2)= 10 B, 3 - A) yields B vendor&lt;/P&gt;&lt;P&gt;West&amp;nbsp; (1 + 1 = 2 for D, 1 for C) yields D vendor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll work on how to add a link to my updated model, but you get the idea.&amp;nbsp; It looks like maybe you are taking the most recent 3 transactions for each vendor, then doing the comparison?&amp;nbsp; The idea is to find the vendor that is currently (based on the latest 3 transactions) providing qty, not the one that provided the most qty over the history.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 19:29:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3936965#M153106</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-21T19:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3939032#M153163</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I misunderstood your needs before. You can try below measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I can't very well restore your real date due to date formatting issues, so the results may change, but the logic should be correct.)&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;Measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Primary Source = 
IF(HASONEFILTER('Fact'[Branch]),
    CALCULATE(
        VAR tempTable = SUMMARIZE('Fact','Fact'[source ],"Recent3MonthsTotal",SUM('Fact'[qty]))
        VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal])
        RETURN
        MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source ]),
        TOPN(3,VALUES('Fact'[month]),'Fact'[month])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table Expression:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table Name = 
ADDCOLUMNS (
    ALL ( 'Fact'[Branch] ),
    "Parimay Source",
        CALCULATE(
            CALCULATE(
                VAR tempTable = SUMMARIZE('Fact','Fact'[source ],"Recent3MonthsTotal",SUM('Fact'[qty]))
                VAR MaxNbr = MAXX(tempTable,[Recent3MonthsTotal])
                RETURN
                MAXX(FILTER(tempTable,[Recent3MonthsTotal]=MaxNbr),'Fact'[source ]),
                TOPN(3,VALUES('Fact'[month]),'Fact'[month])
            )
        )
)&lt;/LI-CODE&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;</description>
      <pubDate>Wed, 22 May 2024 09:41:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3939032#M153163</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-05-22T09:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing a table to align most recent dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3939906#M153181</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;&amp;nbsp;THANK YOU!&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 13:17:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarizing-a-table-to-align-most-recent-dates/m-p/3939906#M153181</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-22T13:17:48Z</dc:date>
    </item>
  </channel>
</rss>

