<?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: Removing duplicates with merging logic in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596427#M176005</link>
    <description>&lt;P&gt;I've used the term duplicate incorrectly. Within the scope of Customer 'Bob' is duplicated. Therefore I'd like the merge these rows.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2025 10:11:48 GMT</pubDate>
    <dc:creator>hewgreen</dc:creator>
    <dc:date>2025-03-05T10:11:48Z</dc:date>
    <item>
      <title>Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596120#M175998</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'm struggling to combine functions correctly (such as FILTER and DISTINCT) in a CALCULATETABLE query. I used the following to generate a slice of a larger input table based on the Product string:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;Slice =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Input Table'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Input Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Product]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"x"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;This is an annonymised version of what it produced:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Instance&lt;/TD&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Quantity&lt;/TD&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;-1&lt;/TD&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;-1&lt;/TD&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0003&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Foo&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0004&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;Bar&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0005&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Do&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need unique rows based on the Customer column. Note 'Bob' is duplicated. I'm not sure how to use DISTINCT in the context of a FILTER. As you see I'm falling early but my full desire is to also handle the merging logic in regard to two aspects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;1. The Instance is a unique value so I'd like this to be handled by concatination, blank or a new string entered 'Multiple'. Whichever is easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;2. Quantity can also differ between instances. I'd like these to be SUM if they do not equal -1. If any equal -1 then -1 should be entered in the new row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've struggled with other answers on this topic. Explinations and pointers to how functions work together would be appreciated. I'm enjoying the early learning phase of DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 07:18:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596120#M175998</guid>
      <dc:creator>hewgreen</dc:creator>
      <dc:date>2025-03-05T07:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596136#M175999</link>
      <description>&lt;P&gt;Addcolumns(&lt;/P&gt;&lt;P&gt;Distinct( tbl[customer]),&lt;/P&gt;&lt;P&gt;"Instances",&lt;/P&gt;&lt;P&gt;calculate( concatenatex( values(tbl[instance]), tbl[instance], ", ")),&lt;/P&gt;&lt;P&gt;"Quantity",&lt;/P&gt;&lt;P&gt;Var sumQuanity = CALCULATE( sum(tbl[quantity] ))&lt;/P&gt;&lt;P&gt;Var minQuantity = calculate( min( tbl[quantity] ))&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;If( minQuanity = -1, minQuanity, sumQuantity)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 07:30:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596136#M175999</guid>
      <dc:creator>Deku</dc:creator>
      <dc:date>2025-03-05T07:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596195#M176001</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1233075" data-lia-user-login="hewgreen" class="lia-mention lia-mention-user"&gt;hewgreen&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From screenshot you provided it don't seems like duplicate, because it has two instance (0001,0002) and customer(Bob) has value for both instance.&lt;BR /&gt;&lt;BR /&gt;Please provide some sample row data to understand better your problem&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Dangar&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 07:58:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596195#M176001</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2025-03-05T07:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596427#M176005</link>
      <description>&lt;P&gt;I've used the term duplicate incorrectly. Within the scope of Customer 'Bob' is duplicated. Therefore I'd like the merge these rows.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 10:11:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596427#M176005</guid>
      <dc:creator>hewgreen</dc:creator>
      <dc:date>2025-03-05T10:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596466#M176006</link>
      <description>&lt;P&gt;This worked well. Thanks so much.&lt;/P&gt;&lt;P&gt;The variables just had some typos. Otherwise flawless.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 10:27:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596466#M176006</guid>
      <dc:creator>hewgreen</dc:creator>
      <dc:date>2025-03-05T10:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596511#M176007</link>
      <description>&lt;P&gt;I noticed that. the sum and min operate over the whole column not grouped. So for my data min is always -1&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 11:14:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596511#M176007</guid>
      <dc:creator>hewgreen</dc:creator>
      <dc:date>2025-03-05T11:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates with merging logic</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596532#M176008</link>
      <description>&lt;P&gt;The sum and mine are calculated within addcolumns. Addcolumns is a iterator, and we are iterating over each customer. The sum and min are wrapped in calculate so context transition applies the current row context of customer into the calculation&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 11:36:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Removing-duplicates-with-merging-logic/m-p/4596532#M176008</guid>
      <dc:creator>Deku</dc:creator>
      <dc:date>2025-03-05T11:36:39Z</dc:date>
    </item>
  </channel>
</rss>

