<?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: Remove Duplicates Per Group (keep first) measure help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192211#M18874</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check if this existing thread helps:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Power-Query/Remove-duplicates-keeping-the-most-recent-row/m-p/757837" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Remove-duplicates-keeping-the-most-recent-row/m-p/757837&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pragati&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2020 12:30:17 GMT</pubDate>
    <dc:creator>Pragati11</dc:creator>
    <dc:date>2020-06-30T12:30:17Z</dc:date>
    <item>
      <title>Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192070#M18864</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to create a measure in PBI that remove duplicate values &lt;STRONG&gt;per group&lt;/STRONG&gt;, and keeps the first occurrence of the value? Perhaps not a measure but maybe a new table, I'm unsure of how to work around this. For context, the database I'm working with has a funky treatment of some data that has a function back-end but doesn't make sense when trying to visualise user behaviour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, the data looks like:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;USER&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ENTRY ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ENTRY&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;STATUS&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;TIME SUBMITTED (HH:mm:ss)&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userA&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;unicorn&lt;/TD&gt;&lt;TD&gt;fail&lt;/TD&gt;&lt;TD&gt;10:23:10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userA&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;forest&lt;/TD&gt;&lt;TD&gt;pass&lt;/TD&gt;&lt;TD&gt;10:30:49&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;userA&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;unicorn&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;fail&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;10:30:49&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userB&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;unicorn&lt;/TD&gt;&lt;TD&gt;fail&lt;/TD&gt;&lt;TD&gt;13:40:22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userB&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;fairy&lt;/TD&gt;&lt;TD&gt;pass&lt;/TD&gt;&lt;TD&gt;13:43:59&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to clean it so it looks like:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;USER&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ENTRY ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ENTRY&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;STATUS&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;TIME SUBMITTED (HH:mm:ss)&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userA&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;unicorn&lt;/TD&gt;&lt;TD&gt;fail&lt;/TD&gt;&lt;TD&gt;10:23:10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userA&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;forest&lt;/TD&gt;&lt;TD&gt;pass&lt;/TD&gt;&lt;TD&gt;10:30:49&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userB&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;unicorn&lt;/TD&gt;&lt;TD&gt;fail&lt;/TD&gt;&lt;TD&gt;13:40:22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;userB&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;fairy&lt;/TD&gt;&lt;TD&gt;pass&lt;/TD&gt;&lt;TD&gt;13:43:59&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note the row I want to remove has&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;duplicated &lt;EM&gt;ENTRY&lt;/EM&gt; from the first instance for &lt;STRONG&gt;userA&lt;/STRONG&gt; and&lt;/LI&gt;&lt;LI&gt;duplicated &lt;EM&gt;TIME SUBMITTED&amp;nbsp;&lt;/EM&gt;from the first instance for &lt;STRONG&gt;userA&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Also, the &lt;EM&gt;ENTRY ID&lt;/EM&gt; cannot be used.&lt;BR /&gt;&lt;BR /&gt;Any pointers would be greatly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 11:31:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192070#M18864</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-30T11:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192211#M18874</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check if this existing thread helps:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Power-Query/Remove-duplicates-keeping-the-most-recent-row/m-p/757837" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Remove-duplicates-keeping-the-most-recent-row/m-p/757837&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pragati&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 12:30:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192211#M18874</guid>
      <dc:creator>Pragati11</dc:creator>
      <dc:date>2020-06-30T12:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192416#M18884</link>
      <description>Yeah... That's a perfect job for Power Query. You can do it in DAX as well as a calculated table but it really should be performed in PQ as this is the data-munging tool. I can create some sample M code for you so that you can see how such cleaning is done...&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Tue, 30 Jun 2020 13:38:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192416#M18884</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-30T13:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192441#M18891</link>
      <description>&lt;P&gt;Here's the M code that does what you want:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi1OLXJU0lEyBOLSvMzk/KI8ICstMTMHJGhgZWRsZWigFKuDUGkEks8vSi0uATIKEouLIQqNDaxMLFEU4jISVaUTTpXGViZA+40wVALliyqR7AaqM7YyBZoYCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [User = _t, EntryID = _t, Entry = _t, Status = _t, Time = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"User", type text}, {"EntryID", Int64.Type}, {"Entry", type text}, {"Status", type text}, {"Time", type time}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "FirstTimeEntry", 
        each List.Min( 
            Table.SelectRows(
                #"Changed Type",
                (r) =&amp;gt; r[User] = [User] and r[Entry] = [Entry]
            )[Time] 
        ) = [Time]),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([FirstTimeEntry] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"FirstTimeEntry"})
in
    #"Removed Columns"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 13:49:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192441#M18891</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-30T13:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192601#M18904</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81077" data-lia-user-login="Pragati11" class="lia-mention lia-mention-user"&gt;Pragati11&lt;/a&gt;&amp;nbsp;, the buffer got me halfway there! Now it's just removing the wrong duplicate, hopefully the other reply will resolve this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 14:52:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1192601#M18904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-30T14:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicates Per Group (keep first) measure help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1194619#M18968</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;Anonymous&lt;/a&gt;, had to have a little play around and add in r[entry id] = [entry id] but it's working well now&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; cheers again&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:10:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Duplicates-Per-Group-keep-first-measure-help/m-p/1194619#M18968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-01T10:10:01Z</dc:date>
    </item>
  </channel>
</rss>

