<?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: Measure to Filter and Aggregate Across 2 Fact Tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2236008#M53404</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274498" data-lia-user-login="russell80" class="lia-mention lia-mention-user"&gt;russell80&lt;/a&gt;&amp;nbsp; can you try this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _filterTbl =
    SUMMARIZE (
        FILTER (
            Budgets,
            CALCULATE ( SUM ( Budgets[Value] ), ALLEXCEPT ( Budgets, Budgets[Name] ) ) &amp;gt; 0
        ),
        Budgets[Name]
    )
RETURN
    CALCULATE ( SUM ( Invoices[Value] ), TREATAS ( _filterTbl, Invoices[Name] ) )
&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Dec 2021 15:47:58 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2021-12-13T15:47:58Z</dc:date>
    <item>
      <title>Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235172#M53371</link>
      <description>&lt;P&gt;Looking for some help with this one. I have a simple model where I have a table of projects, called 'Projects', where [Name] is unique, and this is related to the 'Budgets' and 'Invoices' tables with one-to-many relationships. The 'Result' i am trying to get is a table visual for every&amp;nbsp;'Projects'[Name] with a measure, [Invoiced], which shows a sum of 'Invoices'[Value] for each 'Projects'[Name], for those projects that have a sum of 'Budgets'[Value] greater than 0. Hopefully that makes sense.&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;&amp;nbsp;I got as far as the code below which works for each row in table visual, but the total is off and I can't get this one figured out. I tried adding the ALL filter to CALCULATE to restore it for the Total but that's obviously not working.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Invoiced =
CALCULATE (
    SUM ( 'Invoices'[Value] ),
    FILTER ( 'Budgets', SUM ( 'Budgets'[Values] ) &amp;gt; 0 ),
    ALL ( 'Budgets'[Name] ),
    CROSSFILTER ( 'Budgets'[Name], 'Projects'[Name], BOTH )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Dec 2021 09:06:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235172#M53371</guid>
      <dc:creator>russell80</dc:creator>
      <dc:date>2021-12-13T09:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235395#M53380</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274498" data-lia-user-login="russell80" class="lia-mention lia-mention-user"&gt;russell80&lt;/a&gt;&amp;nbsp;, Try a measure like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure =&lt;BR /&gt;var _inv = calculate(sum(Invoices[Value]))&lt;BR /&gt;var _bud = calculate(sum(Budget[Value]))&lt;BR /&gt;return &lt;BR /&gt;sumc(filter(Values(Project[project]), _bud &amp;gt;0),_inv)&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 11:08:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235395#M53380</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-13T11:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235422#M53382</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;. I gave that a go and it works for each row in the result, but the total is not right. I think for the total, you don't have the filter context to be able to sum the budgets for each project, so all the budgets are summed which comes back as a true condition for the "&amp;gt; 0" filter.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 11:19:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235422#M53382</guid>
      <dc:creator>russell80</dc:creator>
      <dc:date>2021-12-13T11:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235437#M53383</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274498" data-lia-user-login="russell80" class="lia-mention lia-mention-user"&gt;russell80&lt;/a&gt;&amp;nbsp;, These was small mistake, home you have forced row context using values and sumx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example or return&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sumx(filter(Values(Project[project]), _bud &amp;gt;0),_inv)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sumx(summarize(Project,Project[project],"_1",_inv, "_2" _bud), if[_2]&amp;gt;0 ,[_1], blank() )&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 11:34:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235437#M53383</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-13T11:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235471#M53388</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;. I tried both options, see below but I still don't get the correct total&lt;BR /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 11:59:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2235471#M53388</guid>
      <dc:creator>russell80</dc:creator>
      <dc:date>2021-12-13T11:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter and Aggregate Across 2 Fact Tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2236008#M53404</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274498" data-lia-user-login="russell80" class="lia-mention lia-mention-user"&gt;russell80&lt;/a&gt;&amp;nbsp; can you try this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _filterTbl =
    SUMMARIZE (
        FILTER (
            Budgets,
            CALCULATE ( SUM ( Budgets[Value] ), ALLEXCEPT ( Budgets, Budgets[Name] ) ) &amp;gt; 0
        ),
        Budgets[Name]
    )
RETURN
    CALCULATE ( SUM ( Invoices[Value] ), TREATAS ( _filterTbl, Invoices[Name] ) )
&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 15:47:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-and-Aggregate-Across-2-Fact-Tables/m-p/2236008#M53404</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-13T15:47:58Z</dc:date>
    </item>
  </channel>
</rss>

