<?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: SUMX over multiple tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409647#M63416</link>
    <description>&lt;P&gt;missing a comma&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Material Costs = SUMX( Sales,
var currentArticle = Sales[Sales article]
var currentMonth = Sales[Month]
var currentQuantity = Sales[Quantity in KG]
return SUMX( FILTER( 'Material Share', 'Material Share'[Sales article] = currentArticle),
   var currentMaterial = 'Material Share'[Material component]
   var currentShare = 'Material Share'[Share]
   var materialCost = LOOKUPVALUE( 'Material purchase prices'[Purchase Price], 
      'Material purchase prices'[Material component], currentMaterial,
      'Material purchase prices'[Month], currentMonth
)
   return currentQuantity * currentShare * materialCost
)
)&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 22 Mar 2022 13:45:57 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2022-03-22T13:45:57Z</dc:date>
    <item>
      <title>SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2408887#M63347</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I am relatively new to Power BI and don't know how to solve the following. Maybe someone knows the answer and could help, that would be great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have 3 tables (see picture) (meanwhile I uploaded the file here:&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/181jeOfllqmWO1VIIQ8lMpJ0iezT9AgaQ?usp=sharing" target="_blank"&gt;https://drive.google.com/drive/folders/181jeOfllqmWO1VIIQ8lMpJ0iezT9AgaQ?usp=sharing&lt;/A&gt;)&lt;BR /&gt;&lt;BR /&gt;The first table lists sales articles with quantities in kg per month.&lt;BR /&gt;Each of these articles is produced out of different material components. The respective material and it's share is listed in a second table.&lt;BR /&gt;Now each of these raw materials has different purchase prices per months, this is listed in a third table.&lt;BR /&gt;&lt;BR /&gt;I would now like to show the sum of material costs per sales article per month (orange column). I don't want to add a new calculated column tho, I would like to have this calculation completely inside a measure.&lt;BR /&gt;Unfortunately I was not able to create a working DAX formula.&amp;nbsp;&lt;BR /&gt;The formula should lookup the respective material components and it's share and multiply it with the respective purchase price with consideration of the month.&lt;BR /&gt;Also it would be nice if this still works in combination with a time slicer.&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank youuuuu!&lt;BR /&gt;Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:52:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2408887#M63347</guid>
      <dc:creator>romeo</dc:creator>
      <dc:date>2022-03-22T12:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409426#M63390</link>
      <description>&lt;P&gt;Try the below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Material Costs = SUMX( Sales,
var currentArticle = Sales[Sales article]
var currentMonth = Sales[Month]
var currentQuantity = Sales[Quantity]
return SUMX( FILTER( 'Material Share', 'Material Share'[Sales article] = currentArticle)
   var currentMaterial = 'Material Share'[Material]
   var currentShare = 'Material Share'[Share]
   var materialCost = LOOKUPVALUE( 'Material prices'[Purchase price], 
      'Material prices'[Material], currentMaterial,
      'Material prices'[Month], currentMonth
)
   return currentQuantity * currentShare * materialCost
)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:29:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409426#M63390</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-22T12:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409510#M63400</link>
      <description>&lt;P&gt;Thank you johnt75 for your quick response! Unfortunately it did not work. In the meantime I uploaded the file, maybe this helps to solve it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:55:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409510#M63400</guid>
      <dc:creator>romeo</dc:creator>
      <dc:date>2022-03-22T12:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409647#M63416</link>
      <description>&lt;P&gt;missing a comma&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Material Costs = SUMX( Sales,
var currentArticle = Sales[Sales article]
var currentMonth = Sales[Month]
var currentQuantity = Sales[Quantity in KG]
return SUMX( FILTER( 'Material Share', 'Material Share'[Sales article] = currentArticle),
   var currentMaterial = 'Material Share'[Material component]
   var currentShare = 'Material Share'[Share]
   var materialCost = LOOKUPVALUE( 'Material purchase prices'[Purchase Price], 
      'Material purchase prices'[Material component], currentMaterial,
      'Material purchase prices'[Month], currentMonth
)
   return currentQuantity * currentShare * materialCost
)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Mar 2022 13:45:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409647#M63416</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-22T13:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409700#M63422</link>
      <description>&lt;P&gt;Works like a charm! Thank you :)))) That was super fast!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 13:59:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2409700#M63422</guid>
      <dc:creator>romeo</dc:creator>
      <dc:date>2022-03-22T13:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2410840#M63504</link>
      <description>&lt;P&gt;Hi johnt75:&lt;/P&gt;&lt;P&gt;That was an excellent solution! If you are not too busy can you explain how the two SUMX's interact with eachother admist the variables? Where I'm a bit confused is that the measure starts of with SUMX (which appears open ended followed by a new SUMX the reurn. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 00:55:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2410840#M63504</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-23T00:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2411689#M63541</link>
      <description>&lt;P&gt;The outer SUMX iterates over all the sales, but for every sale you need to iterate over all the relevant materials hence the inner SUMX. Using more common programming languages as an analagy, think of it as nested for ... each loops.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 09:09:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2411689#M63541</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-23T09:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over multiple tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2413302#M63666</link>
      <description>&lt;P&gt;Thank you for explaining. I appreciate that!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 19:16:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/m-p/2413302#M63666</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-23T19:16:52Z</dc:date>
    </item>
  </channel>
</rss>

