<?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: Filter by comparing 2 columns in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2377773#M34794</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created a sample pbix file(see attachment) for you, please check whether that is what you want.&lt;/P&gt;
&lt;P&gt;1. Suppose you have a table as follows&lt;/P&gt;
&lt;TABLE width="265"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="88"&gt;A&lt;/TD&gt;
&lt;TD width="99"&gt;B&lt;/TD&gt;
&lt;TD width="78"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;aa&lt;/TD&gt;
&lt;TD&gt;11&lt;/TD&gt;
&lt;TD&gt;ee&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;bb&lt;/TD&gt;
&lt;TD&gt;22&lt;/TD&gt;
&lt;TD&gt;bb&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cc&lt;/TD&gt;
&lt;TD&gt;33&lt;/TD&gt;
&lt;TD&gt;aa&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;dd&lt;/TD&gt;
&lt;TD&gt;44&lt;/TD&gt;
&lt;TD&gt;ff&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;gg&lt;/TD&gt;
&lt;TD&gt;55&lt;/TD&gt;
&lt;TD&gt;vv&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;2. Add a custom column to judge whether the value of A column is equal to the vlaue of C column, if yes then 1 else 0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_0-1646632202214.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679989iA29C6222371E8E0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_0-1646632202214.png" alt="yingyinr_0-1646632202214.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;3. Filter the records which the value of custom column is 0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_1-1646632255471.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679990iCB3F39D808D8CCAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_1-1646632255471.png" alt="yingyinr_1-1646632255471.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4. Remove the custom column&lt;/P&gt;
&lt;P&gt;The full applied codes as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Hcq3DQAxEAPBXhgrkavmcIF8B6r/V58MFgTN1JqCYoS15MHUO50SUG8Yg84Z+L5hTroU2PsfzqFrhXvl/gE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", Int64.Type}, {"C", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "A=C?", each if [A] = [C] then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([#"A=C?"] = 0)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"A=C?"})
in
    #"Removed Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_2-1646632436274.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679994i857FD4DB7BB5A99D/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_2-1646632436274.png" alt="yingyinr_2-1646632436274.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 05:55:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-07T05:55:06Z</dc:date>
    <item>
      <title>Filter by comparing 2 columns</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2370241#M34732</link>
      <description>&lt;P&gt;I have a table with multiple columns.&amp;nbsp; I want to filter out a record if column A = column C.&amp;nbsp; I've seen many variations but not this one in the developer forum.&amp;nbsp; Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 14:06:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2370241#M34732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-02T14:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by comparing 2 columns</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2373468#M34755</link>
      <description>&lt;P&gt;currently only possible as a calculated column or measure flag.&amp;nbsp;&amp;nbsp;If this is important to you please consider raising it at &lt;A href="https://ideas.powerbi.com" target="_blank"&gt;https://ideas.powerbi.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 20:05:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2373468#M34755</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-03-03T20:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by comparing 2 columns</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2377773#M34794</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created a sample pbix file(see attachment) for you, please check whether that is what you want.&lt;/P&gt;
&lt;P&gt;1. Suppose you have a table as follows&lt;/P&gt;
&lt;TABLE width="265"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="88"&gt;A&lt;/TD&gt;
&lt;TD width="99"&gt;B&lt;/TD&gt;
&lt;TD width="78"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;aa&lt;/TD&gt;
&lt;TD&gt;11&lt;/TD&gt;
&lt;TD&gt;ee&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;bb&lt;/TD&gt;
&lt;TD&gt;22&lt;/TD&gt;
&lt;TD&gt;bb&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cc&lt;/TD&gt;
&lt;TD&gt;33&lt;/TD&gt;
&lt;TD&gt;aa&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;dd&lt;/TD&gt;
&lt;TD&gt;44&lt;/TD&gt;
&lt;TD&gt;ff&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;gg&lt;/TD&gt;
&lt;TD&gt;55&lt;/TD&gt;
&lt;TD&gt;vv&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;2. Add a custom column to judge whether the value of A column is equal to the vlaue of C column, if yes then 1 else 0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_0-1646632202214.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679989iA29C6222371E8E0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_0-1646632202214.png" alt="yingyinr_0-1646632202214.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;3. Filter the records which the value of custom column is 0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_1-1646632255471.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679990iCB3F39D808D8CCAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_1-1646632255471.png" alt="yingyinr_1-1646632255471.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4. Remove the custom column&lt;/P&gt;
&lt;P&gt;The full applied codes as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Hcq3DQAxEAPBXhgrkavmcIF8B6r/V58MFgTN1JqCYoS15MHUO50SUG8Yg84Z+L5hTroU2PsfzqFrhXvl/gE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", Int64.Type}, {"C", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "A=C?", each if [A] = [C] then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([#"A=C?"] = 0)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"A=C?"})
in
    #"Removed Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_2-1646632436274.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/679994i857FD4DB7BB5A99D/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_2-1646632436274.png" alt="yingyinr_2-1646632436274.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 05:55:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-by-comparing-2-columns/m-p/2377773#M34794</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-07T05:55:06Z</dc:date>
    </item>
  </channel>
</rss>

