<?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: Which row will keep Table.Distinct(Table, {&amp;quot;Column&amp;quot;}) in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3105405#M99208</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="468331" data-lia-user-login="Belin" class="lia-mention lia-mention-user"&gt;Belin&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;did you buffer the sort operation? (see here:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390" target="_blank" rel="noopener"&gt;Bug warning for Table.Sort and removing duplicates... - Microsoft Power BI Community&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 07:24:00 GMT</pubDate>
    <dc:creator>ImkeF</dc:creator>
    <dc:date>2023-03-01T07:24:00Z</dc:date>
    <item>
      <title>Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081227#M35920</link>
      <description>&lt;P&gt;Hi colleagues,&lt;/P&gt;&lt;P&gt;Which row will keep &lt;STRONG&gt;Table.Distinct(Table, {"Column"})&lt;/STRONG&gt; for the rows with the same values in the "Column":&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;First row?&lt;/LI&gt;&lt;LI&gt;Last row?&lt;/LI&gt;&lt;LI&gt;Random row?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;MS documentation has no explanation about it (&lt;A href="https://docs.microsoft.com/en-us/powerquery-m/table-distinct" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/powerquery-m/table-distinct&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 10:49:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081227#M35920</guid>
      <dc:creator>pavel_severov</dc:creator>
      <dc:date>2020-05-08T10:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081311#M35924</link>
      <description>&lt;P&gt;I believe it keeps the first one.&amp;nbsp; You can do quick try to confirm.&amp;nbsp; You can add a sort step just before that step to keep the one you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 12:07:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081311#M35924</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-08T12:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081317#M35925</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;I, I also "believe" in "First row", but it is good to have official confirmation from MS. Isn't it? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 13:01:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1081317#M35925</guid>
      <dc:creator>pavel_severov</dc:creator>
      <dc:date>2020-05-08T13:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1083073#M36009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228288" data-lia-user-login="pavel_severov" class="lia-mention lia-mention-user"&gt;pavel_severov&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for that, but we did not find any logic definition of this function in official document. But you can confirm it by the Example 2 of the &lt;A href="https://docs.microsoft.com/en-us/powerquery-m/table-distinct" target="_self"&gt;function document&lt;/A&gt;, it will keep the first row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 00:54:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1083073#M36009</guid>
      <dc:creator>v-lid-msft</dc:creator>
      <dc:date>2020-05-11T00:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1151402#M37551</link>
      <description>&lt;P&gt;Hey &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="164769" data-lia-user-login="v-lid-msft" class="lia-mention lia-mention-user"&gt;v-lid-msft&lt;/a&gt; , I did a quick test and that does not seem to be the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I entered the data from that example&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;and used 'Remove duplicates' on &lt;EM&gt;b &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;img /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is what we expected from the documentation and from the assumption that it keeps the first row.&lt;/P&gt;&lt;P&gt;Now to the real test. I altered the order of the first table so that it looks like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;img /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Under the assumption that it keeps the first row, we expect to get the following table:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;b&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but instead we get this:&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;Here's the code for the tests in case anyone wants to check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUUpUitWJVnKCs0BiSUqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    ExampleResult = Table.Distinct(Example, {"b"}),
    ReorderedExample = Table.Sort(Example,{{"a", Order.Descending}}),
    ReorderedExampleResult = Table.Distinct(ReorderedExample, {"b"})
in
    ReorderedExampleResult&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 19:29:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1151402#M37551</guid>
      <dc:creator>tmijail</dc:creator>
      <dc:date>2020-06-10T19:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1153504#M37615</link>
      <description>&lt;P&gt;Ok, this is pretty weird.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I ran the tests again, but instead of reordering the table using Table.Sort I just entered the data in a different order from the start.&lt;/P&gt;&lt;P&gt;Here are the results:&lt;/P&gt;&lt;P&gt;(For some reason I can't embed images even though I had no such problem yesterday. Sorry if this is harder to follow or the images eventually go down)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/ilMrvGe" target="_blank" rel="noopener"&gt;Source&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/yXqz4vB" target="_blank" rel="noopener"&gt;Distinct&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/bmkiXjH" target="_blank" rel="noopener"&gt;Reordered Source&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/aUsvknX" target="_blank" rel="noopener"&gt;Reordered Distinct&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclLSUUpUitWJVnJEYSUpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    ExampleResult = Table.Distinct(Example, {"b"}),
    ReorderedExample = Table.Sort(Example,{{"a", Order.Ascending}}),
    ReorderedExampleResult = Table.Distinct(ReorderedExample, {"b"})
in
    ReorderedExampleResult&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can easily see that order is indeed important, but that for some reason reordering the table using Table.Sort doesn't make a difference. I found that if we need to, we can use Table.Buffer to make Table.Distinct take into account the changes made by Table.Sort. Here's my third and final test:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/Dc4Sjvz" target="_blank" rel="noopener"&gt;Source&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/UPKLl6v" target="_blank" rel="noopener"&gt;Distinct&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/kO4PJNa" target="_blank" rel="noopener"&gt;Reordered Source&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/ksEfTY1" target="_blank" rel="noopener"&gt;Reordered Distinct&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUUpUitWJVnKCs0BiSUqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    ExampleResult = Table.Distinct(Example, {"b"}),
    ReorderedExample = Table.Buffer( Table.Sort(Example,{{"a", Order.Descending}}) ),
    ReorderedExampleResult = Table.Distinct(ReorderedExample, {"b"})
in
    ReorderedExampleResult&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>Thu, 11 Jun 2020 15:52:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1153504#M37615</guid>
      <dc:creator>tmijail</dc:creator>
      <dc:date>2020-06-11T15:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1502198#M46714</link>
      <description>&lt;P&gt;Thank you for doing the work of looking into this and identifying a solution to this frustrating issue.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 13:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1502198#M46714</guid>
      <dc:creator>robertCharlton</dc:creator>
      <dc:date>2020-11-18T13:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509018#M46933</link>
      <description>&lt;P&gt;You are forgetting that if you want to remove distinct letters that are different cases (A/a) then you need to add the optional parameter Comparer.OrdinalIgnoreCase&lt;/P&gt;&lt;P&gt;Table.Distinct(Table, {{“b”,Comparer.OrdinalIgnoreCase}})&lt;/P&gt;&lt;P&gt;This will treat A and a as duplicates. Otherwise, A/a are not the same in this function.&amp;nbsp;&lt;BR /&gt;--Nate&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 18:14:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509018#M46933</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-22T18:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509271#M46937</link>
      <description>&lt;P&gt;it seems as if the sort operation doesn't change the table from the point of view of the table.distinct function and uses the same result as before.(*)&lt;BR /&gt;The operations that "change" the table (manual reordering, table.buffer, adding an index column, replacing any value in the table - even if the new value is the same as the old one -, changing the type of a column) do " start " the procedure of the table.distinct function all over again&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(*) if between the call to the table.distinct function and the definition of the table to which it is applied, only table.sort functions act, the table distinct function is applied to the original table "saving" the sorting operation which is generally heavy.&lt;BR /&gt;Maybe ‌ &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 16:03:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509271#M46937</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-22T16:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509347#M46940</link>
      <description>&lt;P&gt;table.group also appears to have similar behavior to table.distinct.&lt;BR /&gt;After all, a possible algorithm to eliminate duplicates in pseudocode could be like this:&lt;/P&gt;&lt;P&gt;Table.Group (tab, "col", each Table.First (_) [all columns but "col"])&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWJVjJCYSWBWcZwMUOIWCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Raggruppate righe" = Table.Group(Example, {"b"}, {{"all", each Table.First(_)[a]}}),
    Example1 = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Ordinate righe" = Table.Sort(Example1,{{"a", Order.Descending}}),
    #"Raggruppate righe1" = Table.Group(#"Ordinate righe", {"b"}, {{"all", each List.First(_[a]) }})
in
    #"Raggruppate righe1"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the following form the "problem" doesn't arise:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWJVjJCYSWBWcZwMUOIWCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Raggruppate righe" = Table.Group(Example, {"b"}, {{"all", each _}}),
    Example1 = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Ordinate righe" = Table.Sort(Example1,{{"a", Order.Descending}}),
    #"Raggruppate righe1" = Table.Group(#"Ordinate righe", {"b"}, {{"all", each _ }})
in
    #"Raggruppate righe1"&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;and not even like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWJVjJCYSWBWcZwMUOIWCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
    Example = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Raggruppate righe" = Table.Group(Example, {"b"}, {{"all", each _[a]{0}}}),
    Example1 = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
    #"Ordinate righe" = Table.Sort(Example1,{{"a", Order.Descending}}),
    #"Raggruppate righe1" = Table.Group(#"Ordinate righe", {"b"}, {{"all", each _[a]{0} }})
in
    #"Raggruppate righe1"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 19:04:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509347#M46940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-22T19:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509404#M46941</link>
      <description>&lt;P&gt;About table.sort ...&lt;/P&gt;&lt;P&gt;Suppose you have this table:&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;P&gt;if you sort by column a, you get this:&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;but even this different situation would have been valid (third and fourth row are reversed):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;This, I believe, depends on the internal algorithm used to do the sorting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If, as plausible as it may be, the table.distinct algorithm first does a sort of rows to "group" the rows that have duplicate values in the control columns, the ordering of the remaining columns, as we have seen, is not determined.&lt;/P&gt;&lt;P&gt;So if the algorithm also takes the first row of the group, it is not necessarily the "first" row you encounter&amp;nbsp; the source table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 21:00:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1509404#M46941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-22T21:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1897233#M56183</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I think this is similar to my issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Power-Query-Row-disappear-after-expand-column/m-p/929805#M444838" target="_self"&gt;https://community.powerbi.com/t5/Desktop/Power-Query-Row-disappear-after-expand-column/m-p/929805#M444838&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is intended behaviour - Power query steps are not always performed one-by-one. You can force one-by-one by using Table.Buffer&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2021 22:34:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/1897233#M56183</guid>
      <dc:creator>jdusek92</dc:creator>
      <dc:date>2021-06-12T22:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2028821#M59716</link>
      <description>&lt;P&gt;Thanks! This was a big help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:51:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2028821#M59716</guid>
      <dc:creator>RShackelford</dc:creator>
      <dc:date>2021-08-20T19:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2029089#M59719</link>
      <description>&lt;P&gt;Just be aware that if you have to sort your table to define the desired logic, you have to use a Table.Buffer with it, as the sort order might not stick without it (mostly relevant for large tables):&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390" target="_blank"&gt;Bug warning for Table.Sort and removing duplicates... - Microsoft Power BI Community&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 05:54:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2029089#M59719</guid>
      <dc:creator>ImkeF</dc:creator>
      <dc:date>2021-08-21T05:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2120132#M62516</link>
      <description>&lt;P&gt;[SOLUTION]&lt;/P&gt;&lt;P&gt;After googling a lot, I fount this site explaining exactly what happened, and how to solve.&lt;/P&gt;&lt;P&gt;It’s simple, you just need add the buffer of the column you want to sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just add this step:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= Table.Buffer(Table.Sort( #"Linhas Classificadas",{{"data_lancamento", Order.Descending}}))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source: &lt;A href="https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/" target="_self"&gt;https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 22:44:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2120132#M62516</guid>
      <dc:creator>leo_merchan</dc:creator>
      <dc:date>2021-10-06T22:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2120150#M62518</link>
      <description>&lt;P&gt;Here's another article about this topic you might find helpful.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-query/commonissues#preserving-sort" target="_blank"&gt;https://docs.microsoft.com/en-us/power-query/commonissues#preserving-sort&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 23:18:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2120150#M62518</guid>
      <dc:creator>Ehren</dc:creator>
      <dc:date>2021-10-06T23:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2130316#M62881</link>
      <description>&lt;P&gt;I just wanted to let you know I've updated the docs page above based on this thread. Hopefully it's more relevant/helpful now.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:42:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/2130316#M62881</guid>
      <dc:creator>Ehren</dc:creator>
      <dc:date>2021-10-12T16:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3105226#M99196</link>
      <description>&lt;P&gt;I just found out the hard way.&lt;/P&gt;&lt;P&gt;the algorithm goies top to bottom, so I having a set like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number updated_on&lt;/P&gt;&lt;P&gt;inc0001 01/01/22&lt;/P&gt;&lt;P&gt;inc0001 02/01/22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would remove the second occurrence from the top.&lt;/P&gt;&lt;P&gt;I wanted to keep the most updated record, so i sorted the data first, but still the algorithm remove the same&amp;nbsp; record, ignoring any sorting&lt;/P&gt;&lt;P&gt;At the end I'm 99% positive that eliminate from top to bottom every reoccurrence...hoping that is not using a something faster and more difficult to predict and control.&lt;/P&gt;&lt;P&gt;In the past the same function in excel worked this way, so I hope is still the same&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 04:17:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3105226#M99196</guid>
      <dc:creator>Belin</dc:creator>
      <dc:date>2023-03-01T04:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3105405#M99208</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="468331" data-lia-user-login="Belin" class="lia-mention lia-mention-user"&gt;Belin&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;did you buffer the sort operation? (see here:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390" target="_blank" rel="noopener"&gt;Bug warning for Table.Sort and removing duplicates... - Microsoft Power BI Community&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 07:24:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3105405#M99208</guid>
      <dc:creator>ImkeF</dc:creator>
      <dc:date>2023-03-01T07:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Which row will keep Table.Distinct(Table, {"Column"})</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3106706#M99272</link>
      <description>&lt;P&gt;that's interesting, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the end I used this&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=hidJ5T_DYQ0" target="_blank"&gt;https://www.youtube.com/watch?v=hidJ5T_DYQ0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;works like a charm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I jsut noticed that in the notes she added a second better method, which I didn't have the time to try yet&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=QaodJFeX49k" target="_blank"&gt;https://www.youtube.com/watch?v=QaodJFeX49k&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 21:45:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Which-row-will-keep-Table-Distinct-Table-quot-Column-quot/m-p/3106706#M99272</guid>
      <dc:creator>Belin</dc:creator>
      <dc:date>2023-03-01T21:45:41Z</dc:date>
    </item>
  </channel>
</rss>

