<?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: Why is not Function SubstituteWithIndex()   able to detect common columns? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699136#M81579</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="426154" data-lia-user-login="yaowen" class="lia-mention lia-mention-user"&gt;yaowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wait... If you don't create a measure and trying to do it in a table, then why don't you do this easily in Power Query? In Power Query it'll not only be fast but easy as well.&lt;/P&gt;</description>
    <pubDate>Sun, 14 Aug 2022 10:22:12 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-08-14T10:22:12Z</dc:date>
    <item>
      <title>Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2698992#M81564</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Why is not Function SubstituteWithIndex() able to detect common columns between its operands that could be used for join?Please guide and prompt the reasons&amp;nbsp;for such errors.&amp;nbsp;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-SPOILER&gt;&amp;nbsp; &lt;/LI-SPOILER&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I follow the method of adding index columns, but I get an error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SubstituteWithIndex() is not able to detect common columns between its operands that could be used for join.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, if you add one more line of code, it will become a virtual table, and then add an index column to calculate the table，the result is correct result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please give me directions when it's convenient. Thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 06:06:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2698992#M81564</guid>
      <dc:creator>yaowen</dc:creator>
      <dc:date>2022-08-14T06:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699063#M81570</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="426154" data-lia-user-login="yaowen" class="lia-mention lia-mention-user"&gt;yaowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a question: Why do you have to use this function? Truth be told, for all the time that I've been programming in DAX (and that's about 6-7 years now), I've never had a need to use this function. Not a single time.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 08:07:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699063#M81570</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-08-14T08:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699114#M81576</link>
      <description>&lt;P&gt;Such as: Performance optimization of powerbi maximum continuous element number algorithm.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The idea of the staggered element method is to stagger the original elements, and then calculate the start and end marks. Here,&amp;nbsp; changing the vertical comparison to the horizontal comparison, which can greatly reduce the number of iterations.&amp;nbsp; Therefore, the algorithm achieves significant performance improvement&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR MyData = SELECTCOLUMNS( '10W' , "OrginIndex" , [Item] , "Value" , [Flag] )
VAR Add1 = ADDCOLUMNS( MyData , "Value2" , SELECTCOLUMNS( FILTER( MyData , [OrginIndex] = EARLIER( [OrginIndex] ) - 1 ) , "Value" , [Value] ) )
VAR Add1Filterd = FILTER( Add1 , [Value] + [Value2] = 1 )
VAR CreateBegin = ADDCOLUMNS( Add1Filterd , "BeginIndex" , IF( [Value] = 1 , [OrginIndex] ) )
VAR CreateEnd = ADDCOLUMNS( CreateBegin , "EndIndex" , IF( [Value2] = 1 , [OrginIndex] ) )
VAR CreateIndex = SUBSTITUTEWITHINDEX( CreateEnd , "Index" , SELECTCOLUMNS( CreateEnd , "OrginIndex" , [OrginIndex] ) , [OrginIndex] , ASC )
VAR AddAdd = ADDCOLUMNS( CreateIndex , "NewEndIndex" , SELECTCOLUMNS( FILTER( CreateIndex , [Index] = EARLIER( [Index] ) + 1 ) , "NewEndIndex" , [EndIndex] ) )
VAR AddAddFilterd = FILTER( AddAdd , ISBLANK( [EndIndex] ) )
RETURN MAXX( AddAddFilterd , [NewEndIndex] - [BeginIndex] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Among all kinds of optimization, adding index is a very common and immediate optimization method. DAX provides this function to select the future table for the user to add indexes, so I want to understand &lt;STRONG&gt;&amp;nbsp;SUBSTITUTEWITHINDEX. Thank you!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 09:41:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699114#M81576</guid>
      <dc:creator>yaowen</dc:creator>
      <dc:date>2022-08-14T09:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699136#M81579</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="426154" data-lia-user-login="yaowen" class="lia-mention lia-mention-user"&gt;yaowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wait... If you don't create a measure and trying to do it in a table, then why don't you do this easily in Power Query? In Power Query it'll not only be fast but easy as well.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 10:22:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699136#M81579</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-08-14T10:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699142#M81580</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dynamically &amp;nbsp;add index sometimes&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Instead of adding an index in Power Query&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; in advance, the index sometimes should be added in DAX. This is because it can sometimes help this kind of dynamic increase index calculation: dynamic calculation that always occurs after the user selects.&lt;/P&gt;&lt;P&gt;That is to say, if the dynamic calculation involves adding an index after the user selects it, and it is impossible to add an index in Power Query in advance, then the calculation after the user selects it depends on the user's selection and cannot be predicted in advance, so it is called dynamic.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Therefore, it is very valuable to understand that SUBSTITUTEWITHINDEX and DAX provide this function to select the future tables for users to add indexes&lt;SPAN&gt;. Thank you&amp;nbsp;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 10:54:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2699142#M81580</guid>
      <dc:creator>yaowen</dc:creator>
      <dc:date>2022-08-14T10:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why is not Function SubstituteWithIndex()   able to detect common columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2719456#M82863</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="426154" data-lia-user-login="yaowen" class="lia-mention lia-mention-user"&gt;yaowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Why is not Function SubstituteWithIndex() able to detect common columns between its operands that could be used for join?Please guide and prompt the reasons&amp;nbsp;for such errors.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;-&lt;/P&gt;
&lt;P&gt;In my opinion, &lt;STRONG&gt;according to the definition of&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;SubstituteWithIndex()&lt;/STRONG&gt;, "it returns ...of the two tables supplied as arguments", so we need to pass &lt;STRONG&gt;2&lt;/STRONG&gt; tables as arguments to it. In INDEX2, you defined a virtual table &lt;EM&gt;_Product&lt;/EM&gt;, however, in INDEX1, there is only one table.&amp;nbsp;&amp;nbsp;So I guess that's why it's giving an error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;FYI:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dax/substitutewithindex-function-dax" target="_blank" rel="noopener"&gt;SUBSTITUTEWITHINDEX function (DAX) - DAX | Microsoft Docs&lt;/A&gt;&lt;/SPAN&gt;&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;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 07:34:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-not-Function-SubstituteWithIndex-able-to-detect-common/m-p/2719456#M82863</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2022-09-06T07:34:35Z</dc:date>
    </item>
  </channel>
</rss>

