<?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: Filtering table for rows showing the max date per group in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218819#M117587</link>
    <description>&lt;P&gt;This is perfect, thank you so much!!&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 23:23:26 GMT</pubDate>
    <dc:creator>TJohnson6754</dc:creator>
    <dc:date>2023-05-03T23:23:26Z</dc:date>
    <item>
      <title>Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218237#M117542</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that is arranged somewhat like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;RowID&lt;/TD&gt;&lt;TD&gt;ConsumerID&lt;/TD&gt;&lt;TD&gt;VisitDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1111&lt;/TD&gt;&lt;TD&gt;4/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2222&lt;/TD&gt;&lt;TD&gt;4/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1111&lt;/TD&gt;&lt;TD&gt;3/9/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3333&lt;/TD&gt;&lt;TD&gt;5/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;2222&lt;/TD&gt;&lt;TD&gt;3/8/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;3333&lt;/TD&gt;&lt;TD&gt;3/9/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;1111&lt;/TD&gt;&lt;TD&gt;3/8/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;1111&lt;/TD&gt;&lt;TD&gt;2/14/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;3333&lt;/TD&gt;&lt;TD&gt;1/28/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;2222&lt;/TD&gt;&lt;TD&gt;3/31/2023&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to filter for the most recent VisitDate for each ConsumerID so that there will be 1 row per ConsumerID:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;RowID&lt;/TD&gt;&lt;TD&gt;ConsumerID&lt;/TD&gt;&lt;TD&gt;VisitDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1111&lt;/TD&gt;&lt;TD&gt;4/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2222&lt;/TD&gt;&lt;TD&gt;4/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3333&lt;/TD&gt;&lt;TD&gt;5/1/2023&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like I've done this before (successfully) but everything I've tried this time has yielded either errors or unfiltered data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried using combinations of Filter, groupby, max, maxx, summarize, summarizecolumns, topn, etc. I'm sure this is much simpler than I'm making it. Can someone point me in the right direction?&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 15:21:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218237#M117542</guid>
      <dc:creator>TJohnson6754</dc:creator>
      <dc:date>2023-05-03T15:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218269#M117545</link>
      <description>&lt;P&gt;Hey, just to be sure... Do you want this as a measure or do you want a new table with the filtered data? Best, Milan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 15:40:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218269#M117545</guid>
      <dc:creator>milanpasschier3</dc:creator>
      <dc:date>2023-05-03T15:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218302#M117547</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Ideally, I'm looking for a filtered table that retains all the columns. Thank you for taking a look at this!&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:11:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218302#M117547</guid>
      <dc:creator>TJohnson6754</dc:creator>
      <dc:date>2023-05-03T16:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218340#M117551</link>
      <description>&lt;P&gt;Ok, you should create a new table (in my case Sheet1_filtered) with a column named &lt;STRONG&gt;consumerID&lt;/STRONG&gt; (same name as your current table). You can get the distinct ids via:&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;Sheet1_filtered = DISTINCT(Sheet1[ConsumerID])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can than calculate the most recent VisitDate for each ConsumerID in a new column.&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;MostRecentVisitDate = CALCULATE (
    MAX (Sheet1[VisitDate]),
    FILTER ( Sheet1, Sheet1[ConsumerID] = EARLIER ( Sheet1_filtered[ConsumerID] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure there is a relationship between the two consumerID in both tables (use the model view).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sheet1 is your current table. Sheet1_filtered will the table that you should create.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Milan&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:35:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218340#M117551</guid>
      <dc:creator>milanpasschier3</dc:creator>
      <dc:date>2023-05-03T16:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218370#M117554</link>
      <description>&lt;P&gt;Thank you, this is great! Is there a way to also retain the other column(s)? In my example data, it would be RowID column. I tried using LookupValue but since the most recent visit date isn't a unique value, it doesn't work to find its corresponding RowID value. Perhaps I concatenate the ConsumerID and MostRecentVisitID column values in both tables? Is there another way to do it? Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:53:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218370#M117554</guid>
      <dc:creator>TJohnson6754</dc:creator>
      <dc:date>2023-05-03T16:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218409#M117557</link>
      <description>&lt;P&gt;Cool cool, try in the filtered 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;RelatedRowID = 

VAR ConsumerID = Sheet1_filtered[ConsumerID]
VAR MostRecentVisitDate = Sheet1_filtered[MostRecentVisitDate]

RETURN

CALCULATE (
    MAX( Sheet1[RowID]),
    Sheet1[ConsumerID] == ConsumerID &amp;amp;&amp;amp;
    Sheet1[VisitDate] == MostRecentVisitDate
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Milan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS. Make sure to thumbs up and mark as solution if it fits your needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 17:17:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218409#M117557</guid>
      <dc:creator>milanpasschier3</dc:creator>
      <dc:date>2023-05-03T17:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table for rows showing the max date per group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218819#M117587</link>
      <description>&lt;P&gt;This is perfect, thank you so much!!&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 23:23:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-table-for-rows-showing-the-max-date-per-group/m-p/3218819#M117587</guid>
      <dc:creator>TJohnson6754</dc:creator>
      <dc:date>2023-05-03T23:23:26Z</dc:date>
    </item>
  </channel>
</rss>

