<?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 rows by a Criteria in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Remove-rows-by-a-Criteria/m-p/1409900#M44094</link>
    <description>&lt;P&gt;You want Table.SelectRows. Start by removing all rows that are 15 or lower.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;That generates this statement. It is wrong, but Power Query has generated most of what we need.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;= Table.SelectRows(#"Changed Type", each [Call duration] &amp;lt;= 15)&lt;/LI-CODE&gt;
&lt;P&gt;Now manually modify that to be this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;= Table.SelectRows(#"Changed Type", each not ([Call duration] &amp;lt;= 15 and [Campaign] = "A"))&lt;/LI-CODE&gt;
&lt;P&gt;That returns this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;So what I told it is select any records with call durations that are less than 15&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt;&amp;nbsp; are of Campaign A. That is this part:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;([Call duration] &amp;lt;= 15 and [Campaign] = "A")&lt;/LI-CODE&gt;
&lt;P&gt;Since that is the exact opposite of what I really want, I put a "not" in front if it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sense? Full code here:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0UIrVgTCNIEwnqGgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Campaign = _t, #"Call duration" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Campaign", type text}, {"Call duration", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each not ([Call duration] &amp;lt;= 15 and [Campaign] = "A"))
in
    #"Filtered Rows"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use M code provided in a blank query:&lt;BR /&gt;1) In Power Query, select New Source, then Blank Query&lt;BR /&gt;2) On the Home ribbon, select "Advanced Editor" button&lt;BR /&gt;3) Remove everything you see, then paste the M code I've given you in that box.&lt;BR /&gt;4) Press Done&lt;BR /&gt;5) &lt;A href="https://community.powerbi.com/t5/Community-Blog/Utilizing-M-Code-Samples-Given-as-Solutions-in-Power-Query/ba-p/1147514" target="_blank"&gt;See this article if you need help using this M code in your model.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2020 15:46:03 GMT</pubDate>
    <dc:creator>edhans</dc:creator>
    <dc:date>2020-10-02T15:46:03Z</dc:date>
    <item>
      <title>Remove rows by a Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Remove-rows-by-a-Criteria/m-p/1409801#M44088</link>
      <description>&lt;P&gt;I'm pretty new to the M language of Power Query. I'm working with a table that has phone calls and information about each one of them, for what we want it that table could be summarized as this table:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Campaign&lt;/TD&gt;&lt;TD&gt;Call duration&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I want to eliminate the calls that have a duration &amp;lt; 15 and are of campaign A, so the resulting table would look like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Campaign&lt;/TD&gt;&lt;TD&gt;Call duration&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So what I really wanna do is eliminate columns based on a criteria, I didn't seem to find any function capable of doing that at first glance, but I suspect it could be done using the function Table.RemoveMatchingRows, but I don't know how.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 14:55:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Remove-rows-by-a-Criteria/m-p/1409801#M44088</guid>
      <dc:creator>antalgu</dc:creator>
      <dc:date>2020-10-02T14:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Remove rows by a Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Remove-rows-by-a-Criteria/m-p/1409900#M44094</link>
      <description>&lt;P&gt;You want Table.SelectRows. Start by removing all rows that are 15 or lower.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;That generates this statement. It is wrong, but Power Query has generated most of what we need.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;= Table.SelectRows(#"Changed Type", each [Call duration] &amp;lt;= 15)&lt;/LI-CODE&gt;
&lt;P&gt;Now manually modify that to be this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;= Table.SelectRows(#"Changed Type", each not ([Call duration] &amp;lt;= 15 and [Campaign] = "A"))&lt;/LI-CODE&gt;
&lt;P&gt;That returns this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;So what I told it is select any records with call durations that are less than 15&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt;&amp;nbsp; are of Campaign A. That is this part:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;([Call duration] &amp;lt;= 15 and [Campaign] = "A")&lt;/LI-CODE&gt;
&lt;P&gt;Since that is the exact opposite of what I really want, I put a "not" in front if it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sense? Full code here:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0UIrVgTCNIEwnqGgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Campaign = _t, #"Call duration" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Campaign", type text}, {"Call duration", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each not ([Call duration] &amp;lt;= 15 and [Campaign] = "A"))
in
    #"Filtered Rows"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use M code provided in a blank query:&lt;BR /&gt;1) In Power Query, select New Source, then Blank Query&lt;BR /&gt;2) On the Home ribbon, select "Advanced Editor" button&lt;BR /&gt;3) Remove everything you see, then paste the M code I've given you in that box.&lt;BR /&gt;4) Press Done&lt;BR /&gt;5) &lt;A href="https://community.powerbi.com/t5/Community-Blog/Utilizing-M-Code-Samples-Given-as-Solutions-in-Power-Query/ba-p/1147514" target="_blank"&gt;See this article if you need help using this M code in your model.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 15:46:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Remove-rows-by-a-Criteria/m-p/1409900#M44094</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2020-10-02T15:46:03Z</dc:date>
    </item>
  </channel>
</rss>

