<?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 Find duplicate column using max value fom another column and create a new column coded as 0 or 1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2373683#M61024</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;Need to create a new column which finds the duplicates and gives a one to those duplicates which has the highest value in a different column. If 2 duplicates have the highest value give 1 only to the 1st. In the below table for the same customer and the report month if there is a duplicate value the one with the highest sales will be coded as 1 in the Selected column, for eg the combination of SWA and 31 Dec 21 has 2 sales rows; one with 2 and another with 4. The one with 4 will be coded as 1 in the Selected column and the other will be coded as 0.&lt;BR /&gt;|cust|Report_month|Sales|Selected|&lt;BR /&gt;|SWA| 31-Aug-21 | 0 | 1 |&lt;BR /&gt;|SWA| 30-Sep-21 | 0 | 1 |&lt;BR /&gt;|SWA| 31-Oct-21 | 0 | 1 |&lt;BR /&gt;**|SWA|30-Nov-21 | 0 | 1 |**&lt;BR /&gt;**|SWA|31-Dec-21 | 2 | 0 |**&lt;BR /&gt;|SWA|31-Dec-21 | 4 | 1 |&lt;BR /&gt;|CWH|31-May-21 | 0 | 1 |&lt;BR /&gt;**|CWH|31-Aug-21 | 1 | 1 |**&lt;BR /&gt;**|CWH|31-Aug-21 | 0 | 0 |**&lt;BR /&gt;|CWH|31-Oct-21 | 0 | 1 |&lt;BR /&gt;|CWH|30-Nov-21 | 0 | 1 |&lt;BR /&gt;|CWH|31-Dec-21 | 0 | 1 |&lt;BR /&gt;|OSS|31-Aug-21 | 2 | 1 |&lt;BR /&gt;**|OSS|31-Dec-21 | 0 | 0 |**&lt;BR /&gt;|OSS|30-Sep-21 | 0 | 1 |&lt;BR /&gt;**|OSS|31-Oct-21 | 0 | 0 |**&lt;BR /&gt;**|OSS|31-Oct-21 | 5 | 1 |**&lt;BR /&gt;|OSS|30-Nov-21 | 0 | 1 |&lt;BR /&gt;|OSS|31-Aug-21 | 0 | 0 |&lt;BR /&gt;**|OSS|31-Dec-21 | 4 | 1 |**&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2022 22:25:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-03T22:25:40Z</dc:date>
    <item>
      <title>Find duplicate column using max value fom another column and create a new column coded as 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2373683#M61024</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Need to create a new column which finds the duplicates and gives a one to those duplicates which has the highest value in a different column. If 2 duplicates have the highest value give 1 only to the 1st. In the below table for the same customer and the report month if there is a duplicate value the one with the highest sales will be coded as 1 in the Selected column, for eg the combination of SWA and 31 Dec 21 has 2 sales rows; one with 2 and another with 4. The one with 4 will be coded as 1 in the Selected column and the other will be coded as 0.&lt;BR /&gt;|cust|Report_month|Sales|Selected|&lt;BR /&gt;|SWA| 31-Aug-21 | 0 | 1 |&lt;BR /&gt;|SWA| 30-Sep-21 | 0 | 1 |&lt;BR /&gt;|SWA| 31-Oct-21 | 0 | 1 |&lt;BR /&gt;**|SWA|30-Nov-21 | 0 | 1 |**&lt;BR /&gt;**|SWA|31-Dec-21 | 2 | 0 |**&lt;BR /&gt;|SWA|31-Dec-21 | 4 | 1 |&lt;BR /&gt;|CWH|31-May-21 | 0 | 1 |&lt;BR /&gt;**|CWH|31-Aug-21 | 1 | 1 |**&lt;BR /&gt;**|CWH|31-Aug-21 | 0 | 0 |**&lt;BR /&gt;|CWH|31-Oct-21 | 0 | 1 |&lt;BR /&gt;|CWH|30-Nov-21 | 0 | 1 |&lt;BR /&gt;|CWH|31-Dec-21 | 0 | 1 |&lt;BR /&gt;|OSS|31-Aug-21 | 2 | 1 |&lt;BR /&gt;**|OSS|31-Dec-21 | 0 | 0 |**&lt;BR /&gt;|OSS|30-Sep-21 | 0 | 1 |&lt;BR /&gt;**|OSS|31-Oct-21 | 0 | 0 |**&lt;BR /&gt;**|OSS|31-Oct-21 | 5 | 1 |**&lt;BR /&gt;|OSS|30-Nov-21 | 0 | 1 |&lt;BR /&gt;|OSS|31-Aug-21 | 0 | 0 |&lt;BR /&gt;**|OSS|31-Dec-21 | 4 | 1 |**&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 22:25:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2373683#M61024</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-03T22:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Find duplicate column using max value fom another column and create a new column coded as 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2375920#M61192</link>
      <description>&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddCxDoIwEAbgV2mYbdJWfQCig4uSeAMDIYbUiw4oRIqJSR9exAYoPYabvvx3fy7LIt02xp6xrl7m8qie5m6hKLGxgCVqg9coX2URpLFla8nj9saVZJaJbiSbmOCA9YJJnmhDWhc7VW+aJN+j/pPqmaTNmNqlhx8di0+w0NFQXy6TGG85osr3RJd3qaHhhBIA75YKyEuJCdH/dSmvoaBpO0vR5ecNw4XB5/Mv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Split Column by Delimiter", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Sales", Int64.Type}, {"Selected", Int64.Type}, {"Report_month", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (k)=&amp;gt; if Table.Sort(Table.SelectRows(#"Changed Type",each k[cust]=[cust] and k[Report_month]=[Report_month]),{{"Sales", Order.Descending}})[Sales]{0} = k[Sales] then 1 else 0)
in
    #"Added Custom"&lt;/LI-CODE&gt;
&lt;H5&gt;How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".&lt;/H5&gt;</description>
      <pubDate>Fri, 04 Mar 2022 23:20:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2375920#M61192</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-03-04T23:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find duplicate column using max value fom another column and create a new column coded as 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2376422#M61222</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;Please check this out. If this analysis were to go into multiple years we would neeed to change month column to Year&amp;amp;Month, for now it is just answering the question as presented. Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;A title="Assignment of Values" href="https://drive.google.com/file/d/1vXfrY_ha5Sik7idM_F3hAs9EVSHiStiA/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1vXfrY_ha5Sik7idM_F3hAs9EVSHiStiA/view?usp=sharing&lt;/A&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;</description>
      <pubDate>Sat, 05 Mar 2022 14:11:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2376422#M61222</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-05T14:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Find duplicate column using max value fom another column and create a new column coded as 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2383127#M61652</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;Create a column as below.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = 
var _max = CALCULATE(MAX('Table'[Sales]),FILTER('Table','Table'[cust]=EARLIER('Table'[cust])&amp;amp;&amp;amp;'Table'[Report_month]=EARLIER('Table'[Report_month])))
return
IF('Table'[Sales]=_max,1,0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jay&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 09:15:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-duplicate-column-using-max-value-fom-another-column-and/m-p/2383127#M61652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-09T09:15:06Z</dc:date>
    </item>
  </channel>
</rss>

