<?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: Batch ReplaceValue Text does not deliver 'null' in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612283#M79679</link>
    <description>&lt;P&gt;You could optimise it a little bit by skipping all the extra info provided and just customise the Replacer funcion:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table.ReplaceValue(
    Quelle,
    {"#", "n.n.", "na"},
    null,
    (x, y, z) as nullable text =&amp;gt;
        if List.MatchesAny( y, each _ = Text.Lower(x) )
        then z else x,
    {"Responsible"}
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That way, you do not feed it [Responsible] 3 times per calculation, and the check stops once it finds a match, instead of trying to replace every value and if the value is replaced then it replaces the actual value in the record (row).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jun 2022 14:05:16 GMT</pubDate>
    <dc:creator>Smauro</dc:creator>
    <dc:date>2022-06-30T14:05:16Z</dc:date>
    <item>
      <title>Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2611936#M79659</link>
      <description>&lt;P&gt;Dear Powerquery enthusiasts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By reading posts and searching I was able to find a way (Kudos go to Rick de Groot from Gorilla BI!) to replace in a batch multiple values in one step. Now I wanted to replace several values with 'null'. The replacement works, but it turns back blancs, not nulls.&lt;/P&gt;&lt;P&gt;A workaround could be to have a blanc by null replacement following, but I would like to understand were I made a mistake in adjusting Rick's methodology in my environment.&lt;BR /&gt;Here a sample file for testing&amp;nbsp;&lt;A href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fc.gmx.net%2F%40324888734501700174%2FwRcVKVRsSmKqLp_ncGUHdA&amp;amp;data=05%7C01%7C%7C9c7a45bb4aa54273efc808da5a8c2989%7Cfcb2b37b5da0466b9b830014b67a7c78%7C0%7C0%7C637921855861467467%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&amp;amp;sdata=%2F1BJ80tkRuYGOG8REir7DB4AW52jVumfSgIsyLgjJ6U%3D&amp;amp;reserved=0" target="_blank"&gt;https://c.gmx.net/@324888734501700174/wRcVKVRsSmKqLp_ncGUHdA&lt;/A&gt;&lt;BR /&gt;That is the code that returns blancs instead of desired nulls&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ReplaceBatch_PersonResp = Table.ReplaceValue(Quelle,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;each [Responsible],&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;each Text.Combine (List.ReplaceMatchingItems({[Responsible]},{{"#", null}, {"n.n.", null}, {"na", null}}, Comparer.OrdinalIgnoreCase)),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Replacer.ReplaceValue,{"Responsible"})&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be grateful if someone could shed light on this, so that I can also learn, were my understanding is still insufficient.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards, Andreas aka 'Goodkat'&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 11:35:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2611936#M79659</guid>
      <dc:creator>Goodkat</dc:creator>
      <dc:date>2022-06-30T11:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2611981#M79663</link>
      <description>&lt;P&gt;Since this is a single value list, hence Text.Combine is not needed. This is conveting nulls into blanks. Use below formula&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= Table.ReplaceValue(Quelle,
each [Responsible],
each List.ReplaceMatchingItems({[Responsible]},{{"#", null}, {"n.n.", null}, {"na", null}}, Comparer.OrdinalIgnoreCase){0},
Replacer.ReplaceValue,{"Responsible"})&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Jun 2022 11:50:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2611981#M79663</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-30T11:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612270#M79676</link>
      <description>&lt;P&gt;Dear Vijay,&lt;BR /&gt;thank you for your reply. It works perfectly! It implemented the code and also took it into my personal encyclopedia of PowerQuery learnings for annotating it. By thinking about your code lines I stumbled over the braced 0&lt;/P&gt;&lt;P&gt;Comparer.OrdinalIgnoreCase)&lt;STRONG&gt;{0}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is this for? Is it related to the 'Table.ReplaceValue' part?&amp;nbsp;Maybe if you have two minutes left you could let me know the rationale of the {0}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But already now a big 'thank you' to you for providing solution and much appreciated insight.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards, Andreas&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 13:58:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612270#M79676</guid>
      <dc:creator>Goodkat</dc:creator>
      <dc:date>2022-06-30T13:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612278#M79678</link>
      <description>&lt;P&gt;This is to pick up a value from the list on the basis of index. In PQ, index starts with 0.&lt;/P&gt;&lt;P&gt;Hence {0} means I want to pick up first value from the list. If I don't use {0}, it will return the list as an answer. With {0}, the first value gets picked up (in anyway, the list in your case is single value only and that value needs to be extracted)&lt;/P&gt;&lt;P&gt;Hence if list is MyList = {"z","x","a"}, then MyList{0}= "z", MyList{1} = "x", MyList{2}="a"&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 14:02:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612278#M79678</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-30T14:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612283#M79679</link>
      <description>&lt;P&gt;You could optimise it a little bit by skipping all the extra info provided and just customise the Replacer funcion:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table.ReplaceValue(
    Quelle,
    {"#", "n.n.", "na"},
    null,
    (x, y, z) as nullable text =&amp;gt;
        if List.MatchesAny( y, each _ = Text.Lower(x) )
        then z else x,
    {"Responsible"}
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That way, you do not feed it [Responsible] 3 times per calculation, and the check stops once it finds a match, instead of trying to replace every value and if the value is replaced then it replaces the actual value in the record (row).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 14:05:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2612283#M79679</guid>
      <dc:creator>Smauro</dc:creator>
      <dc:date>2022-06-30T14:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2614724#M79805</link>
      <description>&lt;P&gt;Dear Smauro, dear Vijay,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your replies. With Smauro's approach a total new way appeared. Both ways work in my dataset now. I also took your replies into my learning document and commented them for me, in order to understand better. But the more I see the more I get the impression that the possibilities in M appear to be endless! Absolutely crazy what is all possible! And I still know so little only ;(&lt;/P&gt;&lt;P&gt;Thank you both for letting me participate a little bit in your vast experience &amp;amp; knowledge!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great weekend, wherever you are!&lt;/P&gt;&lt;P&gt;Best regards, Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 17:24:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2614724#M79805</guid>
      <dc:creator>Goodkat</dc:creator>
      <dc:date>2022-07-01T17:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Batch ReplaceValue Text does not deliver 'null'</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2614944#M79814</link>
      <description>&lt;P&gt;Here's another possibility:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Table.ReplaceValue(Quelle,
    each [Responsible],
    each if List.Contains({"#", "n.n.", "na"}, Text.Lower([Responsible]))
         then null else [Responsible],
    Replacer.ReplaceValue, {"Responsible"})&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 21:40:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Batch-ReplaceValue-Text-does-not-deliver-null/m-p/2614944#M79814</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-07-01T21:40:37Z</dc:date>
    </item>
  </channel>
</rss>

