<?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: Pattern for getting a value from another fact table based on value from current table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217512#M117500</link>
    <description>&lt;P&gt;If there is only 1 order then you could use LOOKUPVALUE, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OrderID Measure =
VAR VAR_Key_Product_businessUnit =
    SELECTEDVALUE ( 'inventory'[Key_Product_businessUnit] )
VAR VAR_Result =
    LOOKUPVALUE (
        'Orders'[OrderID],
        'Orders'[Key_Product_businessUnit], VAR_Key_Product_businessUnit
    )
RETURN
    VAR_Result
&lt;/LI-CODE&gt;
&lt;P&gt;You could also do it as a calculated column like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OrderID Column =
LOOKUPVALUE (
    'Orders'[OrderID],
    'Orders'[Key_Product_businessUnit], 'inventory'[Key_Product_businessUnit]
)
&lt;/LI-CODE&gt;
&lt;P&gt;You would probably get better performance doing it as a column.&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 09:54:11 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-05-03T09:54:11Z</dc:date>
    <item>
      <title>Pattern for getting a value from another fact table based on value from current table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217348#M117490</link>
      <description>&lt;P&gt;I have two trimmed down fact tables and two dimension tables. The dimesnion tables filter both fact tables.&lt;BR /&gt;&lt;BR /&gt;For my inventory (fact) table I want to retrieve the order id from the orders table. In the report&amp;nbsp; there is a table showing inventory details at the level of [Key_Product_businessUnit].&lt;BR /&gt;&lt;BR /&gt;My Measure is&amp;nbsp;&lt;BR /&gt;OrderID =&amp;nbsp;&lt;BR /&gt;VAR&amp;nbsp;VAR_Key_Product_businessUnit = SELECTEDVALUE('inventory'[Key_Product_businessUnit])&lt;BR /&gt;VAR VAR_Result =&amp;nbsp;&lt;BR /&gt;CALCULATE(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Orders'[OrderID]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Orders'[Key_Product_businessUnit] = VAR_Key_Product_businessUnit&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;VAR_Result&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this the best pattern to use. It seems to be really slow? There is only one row (or so the business users tell me) in Orders for each row in inventory.&lt;BR /&gt;&lt;BR /&gt;JUst does not seem efficient.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 08:26:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217348#M117490</guid>
      <dc:creator>ells69</dc:creator>
      <dc:date>2023-05-03T08:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern for getting a value from another fact table based on value from current table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217512#M117500</link>
      <description>&lt;P&gt;If there is only 1 order then you could use LOOKUPVALUE, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OrderID Measure =
VAR VAR_Key_Product_businessUnit =
    SELECTEDVALUE ( 'inventory'[Key_Product_businessUnit] )
VAR VAR_Result =
    LOOKUPVALUE (
        'Orders'[OrderID],
        'Orders'[Key_Product_businessUnit], VAR_Key_Product_businessUnit
    )
RETURN
    VAR_Result
&lt;/LI-CODE&gt;
&lt;P&gt;You could also do it as a calculated column like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OrderID Column =
LOOKUPVALUE (
    'Orders'[OrderID],
    'Orders'[Key_Product_businessUnit], 'inventory'[Key_Product_businessUnit]
)
&lt;/LI-CODE&gt;
&lt;P&gt;You would probably get better performance doing it as a column.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 09:54:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217512#M117500</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-05-03T09:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern for getting a value from another fact table based on value from current table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217689#M117508</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="514559" data-lia-user-login="ells69" class="lia-mention lia-mention-user"&gt;ells69&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You may try with TREATAS. It is not usually super fast but it could improve the performance in some scenarios.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;OrderID =
IF (
    HASONEVALUE ( 'inventory'[Key_Product_businessUnit] ),
    CALCULATE (
        MAX ( 'Orders'[OrderID] ),
        TREATAS (
            VALUES ( 'inventory'[Key_Product_businessUnit] ),
            'Orders'[Key_Product_businessUnit]
        )
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 03 May 2023 11:28:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Pattern-for-getting-a-value-from-another-fact-table-based-on/m-p/3217689#M117508</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-05-03T11:28:34Z</dc:date>
    </item>
  </channel>
</rss>

