<?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: Replacing table with table in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1263992#M40468</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.&lt;/P&gt;
&lt;P&gt;t_Defaults:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;t_Customizations:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may go to 'Query Editor', create an index column for each table. Then you may create a blank query, input the following codes in 'Advanced Editor'.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.NestedJoin(t_Customizations, {"Index"}, t_Defaults, {"Index"}, "t_Defaults", JoinKind.LeftOuter),
    Custom1 = Table.AddColumn(Source,"NewTopology",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Topology]
else
Table.Column([t_Defaults],"Topology"){0}
),
    Custom2 = Table.AddColumn(Custom1,"NewTier",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Tier]
else
Table.Column([t_Defaults],"Tier"){0}
),
    Custom3 = Table.AddColumn(Custom2,"NewFunction",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Function]
else
Table.Column([t_Defaults],"Function"){0}
),
    Custom4 = Table.AddColumn(Custom3,"NewCol1",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col1]
else
Table.Column([t_Defaults],"Col1"){0}
),
    Custom5 = Table.AddColumn(Custom4,"NewCol2",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col2]
else
Table.Column([t_Defaults],"Col2"){0}
),
    Custom6 = Table.AddColumn(Custom5,"NewCol3",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col3]
else
Table.Column([t_Defaults],"Col3"){0}
),
    Custom7 = Table.AddColumn(Custom6,"NewCol4",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col4]
else
Table.Column([t_Defaults],"Col4"){0}
),
    Custom8 = Table.AddColumn(Custom7,"NewStorageProtocol",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [StorageProtocol]
else
Table.Column([t_Defaults],"StorageProtocol"){0}
),
    Custom9 = Table.AddColumn(Custom8,"NewProtocolVersion",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [ProtocolVersion]
else
Table.Column([t_Defaults],"ProtocolVersion"){0}
),
    #"Removed Other Columns" = Table.SelectColumns(Custom9,{"NewTopology", "NewTier", "NewFunction", "NewCol1", "NewCol2", "NewCol3", "NewCol4", "NewStorageProtocol", "NewProtocolVersion"})
in
    #"Removed Other Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&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;Allan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial',sans-serif;"&gt;If this post &lt;STRONG&gt;&lt;SPAN style="font-family: 'Arial',sans-serif;"&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;&lt;SPAN style="font-family: 'Arial',sans-serif;"&gt;Accept it as the solution&lt;/SPAN&gt;&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Jul 2020 06:27:32 GMT</pubDate>
    <dc:creator>v-alq-msft</dc:creator>
    <dc:date>2020-07-31T06:27:32Z</dc:date>
    <item>
      <title>Replacing table with table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1262387#M40430</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using PQ in Excel.&lt;/P&gt;&lt;P&gt;i have 2 sources: t_Defaults and t_Customizations with composite Key: Topology&amp;amp;Tier&amp;amp;Function&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;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a base i am using t_Defaults but what i want to do is:&lt;/P&gt;&lt;P&gt;1) If any row in t_Customizations is fullfilled (all columns, if one is empty - skip this row !) replace corresponding row (composite key) with corresponding composite key from t_Defaults.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) If table t_Customizations is empty - just use t_Defaults.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So as you can see:&lt;/P&gt;&lt;P&gt;1) First row has been replaced from (Topo1&amp;amp;Tier1&amp;amp;Function1 key) t_Defaults with corresponding values from t_Customizations&lt;/P&gt;&lt;P&gt;2) Second row&amp;nbsp;&amp;nbsp; has been replaced from (Topo2&amp;amp;Tier2&amp;amp;Function2 key) t_Defaults with corresponding values from t_Customizations&lt;/P&gt;&lt;P&gt;3) third row from t_defaults was not replaced because key&amp;nbsp;Topo3&amp;amp;Tier3&amp;amp;Function3 do not exists in t_Customizations table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help? I am starting my adventure with Power Query and DAX.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Jacek&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 14:25:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1262387#M40430</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2020-07-30T14:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing table with table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1262410#M40431</link>
      <description>&lt;P&gt;I want to add example file but i am not seeing option on this forum so i am sharing google drive link:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1XhjPvYp8QANPFb1n-KJG5aMSnPz4SiZC/view?usp=sharing" target="_blank" rel="noopener"&gt;https://drive.google.com/file/d/1XhjPvYp8QANPFb1n-KJG5aMSnPz4SiZC/view?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 14:26:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1262410#M40431</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2020-07-30T14:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing table with table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1263992#M40468</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.&lt;/P&gt;
&lt;P&gt;t_Defaults:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;t_Customizations:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may go to 'Query Editor', create an index column for each table. Then you may create a blank query, input the following codes in 'Advanced Editor'.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.NestedJoin(t_Customizations, {"Index"}, t_Defaults, {"Index"}, "t_Defaults", JoinKind.LeftOuter),
    Custom1 = Table.AddColumn(Source,"NewTopology",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Topology]
else
Table.Column([t_Defaults],"Topology"){0}
),
    Custom2 = Table.AddColumn(Custom1,"NewTier",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Tier]
else
Table.Column([t_Defaults],"Tier"){0}
),
    Custom3 = Table.AddColumn(Custom2,"NewFunction",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Function]
else
Table.Column([t_Defaults],"Function"){0}
),
    Custom4 = Table.AddColumn(Custom3,"NewCol1",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col1]
else
Table.Column([t_Defaults],"Col1"){0}
),
    Custom5 = Table.AddColumn(Custom4,"NewCol2",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col2]
else
Table.Column([t_Defaults],"Col2"){0}
),
    Custom6 = Table.AddColumn(Custom5,"NewCol3",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col3]
else
Table.Column([t_Defaults],"Col3"){0}
),
    Custom7 = Table.AddColumn(Custom6,"NewCol4",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [Col4]
else
Table.Column([t_Defaults],"Col4"){0}
),
    Custom8 = Table.AddColumn(Custom7,"NewStorageProtocol",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [StorageProtocol]
else
Table.Column([t_Defaults],"StorageProtocol"){0}
),
    Custom9 = Table.AddColumn(Custom8,"NewProtocolVersion",
each if
[Topology]=Table.Column([t_Defaults],"Topology"){0}and
[Tier]=Table.Column([t_Defaults],"Tier"){0}and
[Function]=Table.Column([t_Defaults],"Function"){0}
then [ProtocolVersion]
else
Table.Column([t_Defaults],"ProtocolVersion"){0}
),
    #"Removed Other Columns" = Table.SelectColumns(Custom9,{"NewTopology", "NewTier", "NewFunction", "NewCol1", "NewCol2", "NewCol3", "NewCol4", "NewStorageProtocol", "NewProtocolVersion"})
in
    #"Removed Other Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&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;Allan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial',sans-serif;"&gt;If this post &lt;STRONG&gt;&lt;SPAN style="font-family: 'Arial',sans-serif;"&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;&lt;SPAN style="font-family: 'Arial',sans-serif;"&gt;Accept it as the solution&lt;/SPAN&gt;&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 06:27:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1263992#M40468</guid>
      <dc:creator>v-alq-msft</dc:creator>
      <dc:date>2020-07-31T06:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing table with table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1264085#M40470</link>
      <description>&lt;P&gt;Thank you very much! This seems not to work for me, I added index column on each my table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And implemented your formula into new query but i deleted or records from t_Customizations:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it should show all records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore if i will add one new column i will have a lot of work to implement your solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We should find better way, i belive that exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take a look from link here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/36356471/check-if-power-query-table-is-empty-then-return-something-else" target="_self"&gt;https://stackoverflow.com/questions/36356471/&amp;nbsp; &amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/36356471/check-if-power-query-table-is-empty-then-return-something-else" target="_self"&gt;check-if-power-query-table-is-empty-then-return-something-else&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I could implement solution from here i could work around a lot of code but i am beginner and it is hard to understand how to do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe you can help with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is just simple merging if row is or not based on index column...&lt;/P&gt;&lt;P&gt;Jacek&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 07:12:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1264085#M40470</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2020-07-31T07:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing table with table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1264594#M40481</link>
      <description>&lt;P&gt;i added new column to Defaults : Environments and i am proud because i think that i solved the issue:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;t_Customizations:&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;and result is:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;seems to be easy in PQ:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;created 3 new queries:&lt;/DIV&gt;&lt;DIV&gt;DefaultsSourceNotMatchCust:&lt;/DIV&gt;&lt;DIV&gt;let&lt;BR /&gt;Source = Excel.CurrentWorkbook(){[Name="t_Defaults"]}[Content],&lt;BR /&gt;#"Merged Queries" = Table.NestedJoin(Source, {"Topology", "Tier", "Function"}, t_Customizations, {"Topology", "Tier", "Function"}, "t_Customizations", JoinKind.LeftAnti),&lt;BR /&gt;#"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"t_Customizations"})&lt;BR /&gt;in&lt;BR /&gt;#"Removed Columns"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;t_DefaultsMatchCust:&lt;/DIV&gt;&lt;DIV&gt;let&lt;BR /&gt;Source = Excel.CurrentWorkbook(){[Name="t_Defaults"]}[Content],&lt;BR /&gt;#"Merged Queries" = Table.NestedJoin(Source, {"Topology", "Tier", "Function"}, t_Customizations, {"Topology", "Tier", "Function"}, "t_Customizations", JoinKind.Inner),&lt;BR /&gt;#"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Col1", "Col2", "Col3", "Col4", "StorageProtocol", "ProtocolVersion"}),&lt;BR /&gt;#"Expanded t_Customizations" = Table.ExpandTableColumn(#"Removed Columns", "t_Customizations", {"Col1", "Col2", "Col3", "Col4", "StorageProtocol", "ProtocolVersion"}, {"Col1", "Col2", "Col3", "Col4", "StorageProtocol", "ProtocolVersion"})&lt;BR /&gt;in&lt;BR /&gt;#"Expanded t_Customizations"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;and after that i appened tables.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Working like a charm!&lt;/DIV&gt;&lt;DIV&gt;Best,&lt;/DIV&gt;&lt;DIV&gt;Jacek&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:30:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Replacing-table-with-table/m-p/1264594#M40481</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2020-07-31T10:30:11Z</dc:date>
    </item>
  </channel>
</rss>

