<?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: Handling tables in memory in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1601864#M32128</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can acheive the expected result by creating the following table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyTable = 
VAR Tab1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
VAR Tab2 = { 4, 5, 7 }
RETURN
    ADDCOLUMNS (
        Tab1,
        "Found",
            VAR C1 = [Value]
            RETURN
                CALCULATE ( COUNTROWS ( FILTER ( Tab2, [Value] = C1 ) ) ) + 0
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please click &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help other members find it useful&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.excelfort.com" target="_blank"&gt;&lt;FONT color="blue"&gt;Website&lt;/FONT&gt;&lt;/A&gt; &lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2021 11:12:53 GMT</pubDate>
    <dc:creator>Fowmy</dc:creator>
    <dc:date>2021-01-15T11:12:53Z</dc:date>
    <item>
      <title>Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599360#M32051</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a new column for a table counting how many times each value appears on another table. Please see diagram below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;With normal tables, this is relatively easy, eg.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Expected result = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;ADDCOLUMNS(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; table1,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "found",&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COUNTROWS(table2),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER(table2, table1[Value] = table2[Value])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;The problem is that I've written a rather large and complicated code that relies on this same operation, but where both tables are actually variables (e.g.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;table1 = {1,2,3,4,5,6,7,8,9}) instead of normal tables&lt;/SPAN&gt;&lt;SPAN&gt;, and of couse, you can't do table1[Value] in these cases. I've tried countless approaches, and I can't get it to work.&lt;BR /&gt;Any ideas?&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Jan 2021 11:16:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599360#M32051</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-14T11:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599402#M32052</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Create the table as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; ADDCOLUMNS(
      table1,
      "found", 
      var c1 =  table1[Value]  return
      CALCULATE(
         COUNTROWS(table2),
         table2[Value] = c1
      )
)&lt;/LI-CODE&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please click &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help other members find it useful&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.excelfort.com" target="_blank"&gt;&lt;FONT color="blue"&gt;Website&lt;/FONT&gt;&lt;/A&gt; &lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 11:35:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599402#M32052</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-01-14T11:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599519#M32062</link>
      <description>&lt;P&gt;Thank you for the reply, but Power BI does not accept &lt;STRONG&gt;table1[value]&lt;/STRONG&gt; when table1 is a variable and not a normal table. That's the problem I had.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 12:42:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1599519#M32062</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-14T12:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1601049#M32112</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt; , That ia an array, You have create table like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;union(&lt;/P&gt;
&lt;P&gt;ROW("Value", 1),&lt;BR /&gt;ROW("Value", 2),&lt;BR /&gt;ROW("Value", 3)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 05:03:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1601049#M32112</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-01-15T05:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1601864#M32128</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can acheive the expected result by creating the following table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyTable = 
VAR Tab1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
VAR Tab2 = { 4, 5, 7 }
RETURN
    ADDCOLUMNS (
        Tab1,
        "Found",
            VAR C1 = [Value]
            RETURN
                CALCULATE ( COUNTROWS ( FILTER ( Tab2, [Value] = C1 ) ) ) + 0
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please click &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help other members find it useful&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.excelfort.com" target="_blank"&gt;&lt;FONT color="blue"&gt;Website&lt;/FONT&gt;&lt;/A&gt; &lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 11:12:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1601864#M32128</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-01-15T11:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Handling tables in memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1602290#M32135</link>
      <description>&lt;P&gt;Genius! Thank you very much!!!&lt;BR /&gt;I'd swear I've tried something very very similar to what you wrote, but I obviously did something wrong -probably when to filter.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 14:27:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Handling-tables-in-memory/m-p/1602290#M32135</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-15T14:27:58Z</dc:date>
    </item>
  </channel>
</rss>

