<?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: Lookup between virtual tables without relationship in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3315895#M124065</link>
    <description>&lt;P&gt;I think you can do the whole thing in 1 step without needing the first table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DEFINE
    VAR _tbl =
        ADDCOLUMNS (
            SUMMARIZE ( 'person', 'person'[person id], 'mgr'[mgr id] ),
            "mgr size",
                VAR CurrentManager = 'mgr'[mgr id]
                VAR Result =
                    CALCULATE (
                        [total],
                        REMOVEFILTERS ( 'mgr'[mgr id] ),
                        TREATAS ( { CurrentManager }, 'person'[person id] )
                    )
                RETURN
                    Result
        )

EVALUATE
_tbl
&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 05 Jul 2023 09:45:05 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-07-05T09:45:05Z</dc:date>
    <item>
      <title>Lookup between virtual tables without relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3314993#M124021</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I am quite new to DAX magic and been practicing a lot in the last few months, but still I can't fully understand the concept of lookup values based on columns from "virtual tables", even though I've read the articles about it, and also about the TREATAS function that probably should help here. No matter which method i've used in my code to add the column of lookup value from one table to another, I'm getting the same message of "table variable "xxx" cannot be used in this concept, because a base table is expected" &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, my example is very simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; DEFINE
    VAR _size =
        ADDCOLUMNS (

          SUMMARIZECOLUMNS ( 'person'[person id] ), 

          "total", 'measures'[total]

         )
    VAR _tbl =
        ADDCOLUMNS (
            SUMMARIZECOLUMNS ( 'person'[person id], 'mgr'[mgr id] ),
            "lookup", LOOKUPVALUE ( '_size'[total], '_size'[person id], '_tbl'[mgr id], 0 )
        )

EVALUATE
_tbl&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;definitions:&lt;/P&gt;&lt;P&gt;'person' and 'mgr' are actual physical tables, [total] is a meassure as part of the model.&lt;/P&gt;&lt;P&gt;so the &lt;STRONG&gt;idea is to add a new column to _tbl1 called "lookup" that will bring the [total] for each [mgr id] matching [mgr id] to [person id].&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;so as mentioned the error i get is about the fact that those tables are not physical ones in my model, but a virtual temp tables that i'm creating in thie query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so what's the method that can be used to do a lookup between non-related virtual table variables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 04:05:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3314993#M124021</guid>
      <dc:creator>talsed</dc:creator>
      <dc:date>2023-07-05T04:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup between virtual tables without relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3315895#M124065</link>
      <description>&lt;P&gt;I think you can do the whole thing in 1 step without needing the first table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DEFINE
    VAR _tbl =
        ADDCOLUMNS (
            SUMMARIZE ( 'person', 'person'[person id], 'mgr'[mgr id] ),
            "mgr size",
                VAR CurrentManager = 'mgr'[mgr id]
                VAR Result =
                    CALCULATE (
                        [total],
                        REMOVEFILTERS ( 'mgr'[mgr id] ),
                        TREATAS ( { CurrentManager }, 'person'[person id] )
                    )
                RETURN
                    Result
        )

EVALUATE
_tbl
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Jul 2023 09:45:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3315895#M124065</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-07-05T09:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup between virtual tables without relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3317820#M124150</link>
      <description>&lt;P&gt;thanks but it didn't help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;also it's getting error as there are 2 different tables of 'person' and 'mgr' in SUMMARIZE function.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 07:37:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Lookup-between-virtual-tables-without-relationship/m-p/3317820#M124150</guid>
      <dc:creator>talsed</dc:creator>
      <dc:date>2023-07-06T07:37:04Z</dc:date>
    </item>
  </channel>
</rss>

