<?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: Left join with three tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015966#M158280</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="767509" data-lia-user-login="Trodo737" class="lia-mention lia-mention-user"&gt;Trodo737&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing you're using either the measure or the calculated column option? Both of these options need to return scalar values, whereas I gave you the expression to create a table. Obviously, a table can't fit into a cell. So you should use the "New Table" option.&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;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 15:28:20 GMT</pubDate>
    <dc:creator>xifeng_L</dc:creator>
    <dc:date>2024-06-28T15:28:20Z</dc:date>
    <item>
      <title>Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4014955#M158195</link>
      <description>&lt;P&gt;I have three tables, T1, T2 and T3. T2 has relation with T1 and T3 but T1 and T3 don't have any relation. How can I convert the following SQL to DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; SELECT 
      t2.col1
     ,FORMAT(SUM(CAST(t1.cal7 AS BIGINT)), '### ### ### ###') AS 'Total'
     ,t3.col5
  FROM T2 t2
  LEFT JOIN T1 t1      ON t2.IDnr = t1.IDnr
  LEFT JOIN T3 t3      ON t2.identifiernr= t3.identifiernr
  WHERE t3.col4 LIKE 'LastReport'  
  GROUP BY t2.col1, t3.col5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both t2.col1 and t3.col5 have nvarchar as datatype. I want to show result as a barchart in Power BI report where the Legend is t3.col5, t2.col1 is on X-axis and&amp;nbsp; Total on Y-axis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 07:19:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4014955#M158195</guid>
      <dc:creator>Trodo737</dc:creator>
      <dc:date>2024-06-28T07:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015451#M158223</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="767509" data-lia-user-login="Trodo737" class="lia-mention lia-mention-user"&gt;Trodo737&lt;/a&gt;&amp;nbsp;, You can do it using measures in Power BI but make sure relation between T2 and T3 , and T1 and T3 is established ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure using&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Total = &lt;BR /&gt;VAR FilteredT3 = &lt;BR /&gt;FILTER(&lt;BR /&gt;T3,&lt;BR /&gt;T3[col4] = "LastReport"&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX(&lt;BR /&gt;FILTER(&lt;BR /&gt;T1,&lt;BR /&gt;T1[IDnr] IN VALUES(T2[IDnr])&lt;BR /&gt;),&lt;BR /&gt;T1[cal7]&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;FormattedTotal = &lt;BR /&gt;FORMAT(&lt;BR /&gt;[Total],&lt;BR /&gt;"### ### ### ###"&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can use Formatted Total as value in bar chart visual&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 11:08:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015451#M158223</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-06-28T11:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015493#M158229</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="767509" data-lia-user-login="Trodo737" class="lia-mention lia-mention-user"&gt;Trodo737&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please make sure that PowerBI is modelling the relationships correctly, both T1 and T2 and T3 and T2 should be one-to-many relationships.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then please try the following queries or new tables expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX Query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVALUATE
SUMMARIZE (
    CALCULATETABLE ( 'T2', 'T3'[col4] = "LastReport" ),
    'T2'[col1],
    'T3'[col5],
    "Total", SUM ( 'T1'[col7] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TableName = 
SUMMARIZE (
    CALCULATETABLE ( 'T2', 'T3'[col4] = "LastReport" ),
    'T2'[col1],
    'T3'[col5],
    "Total", SUM ( 'T1'[col7] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 11:26:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015493#M158229</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-06-28T11:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015539#M158237</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I'm totaly new in DAX. I checked it and&amp;nbsp;the relationships are one-to-many:&lt;/P&gt;&lt;P&gt;T2 -&amp;gt; T1&amp;nbsp; is one-to many&lt;/P&gt;&lt;P&gt;T2 -&amp;gt; T3&amp;nbsp; is one-to-many&lt;/P&gt;&lt;P&gt;and T1 and T3 doesn't have any relationship.&lt;/P&gt;&lt;P&gt;When I use the dax code you suggested getting this error:&amp;nbsp;The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 11:54:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015539#M158237</guid>
      <dc:creator>Trodo737</dc:creator>
      <dc:date>2024-06-28T11:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015618#M158249</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I mentioned there is no relationship between T1 and T3 but each of them has relationship to T2 on different columns(IDnr and identifiernr).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested your suggested dax code, it works but it shows the same result(for SUMX) for all rows(without VAR FilteredT3). When I run SQL query getting different nummers for each rows:&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;In both t2.col1 and t3.col5 there are other rows, this is just an example of the result I'm trying to get with dax code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 13:11:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015618#M158249</guid>
      <dc:creator>Trodo737</dc:creator>
      <dc:date>2024-06-28T13:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015966#M158280</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="767509" data-lia-user-login="Trodo737" class="lia-mention lia-mention-user"&gt;Trodo737&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing you're using either the measure or the calculated column option? Both of these options need to return scalar values, whereas I gave you the expression to create a table. Obviously, a table can't fit into a cell. So you should use the "New Table" option.&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;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 15:28:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4015966#M158280</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-06-28T15:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with three tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4016090#M158303</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="767509" data-lia-user-login="Trodo737" class="lia-mention lia-mention-user"&gt;Trodo737&lt;/a&gt;&amp;nbsp;, You can try this measue if still there is still issue can you share sample data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;Total = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;FORMAT(&lt;BR /&gt;SUMX(&lt;BR /&gt;T1,&lt;BR /&gt;T1[cal7]&lt;BR /&gt;),&lt;BR /&gt;"### ### ### ###"&lt;BR /&gt;),&lt;BR /&gt;T3[col4] = "LastReport"&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 17:13:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Left-join-with-three-tables/m-p/4016090#M158303</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-06-28T17:13:43Z</dc:date>
    </item>
  </channel>
</rss>

