<?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: Sum with multiple criteria in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2327544#M58331</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="353745" data-lia-user-login="tackytechtom" class="lia-mention lia-mention-user"&gt;tackytechtom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still taking my first baby steps with Power BI but if I understand it correctly, using the filter pane would only allow me to filter on transaction level (sales details) in this case? However, yes I would like to have it as a measure to do further visualisations. The measure would calculate if the order was transported by a full trailer directly from the distributor to customer or if the customer bought smaller volumes from our local site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to sum it at the Invoice No level. For example, the wanted result for Invoice No 468001 that I posted at the end would sum up to 150 + 19.750 + 400 = 20.300 and all of these items are within the Item Category "43".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure there are posted solutions somewhere but being new to DAX and being non-English native speaker, I'm yet a bit lost with what keywords to use. My aim is to level up to par with my google skills within excel &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2022 07:49:53 GMT</pubDate>
    <dc:creator>Plin0987</dc:creator>
    <dc:date>2022-02-09T07:49:53Z</dc:date>
    <item>
      <title>Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2325243#M58187</link>
      <description>&lt;P&gt;I would like to filter so that I only have transactions with the criteria:&lt;/P&gt;&lt;P&gt;- The total weight of the invoice is &amp;gt; 20.000, only counting Items with Item Category = 43&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Three tables include the information needed: Sales Header, Sales Details, Items&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales Header:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Invoice No&lt;/TD&gt;&lt;TD&gt;Customer ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468002&lt;/TD&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468003&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468004&lt;/TD&gt;&lt;TD&gt;112&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales Details:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Document No&lt;/TD&gt;&lt;TD&gt;Item No&lt;/TD&gt;&lt;TD&gt;Qty&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;100-101&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;200-205&lt;/TD&gt;&lt;TD&gt;790&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;300-404&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468002&lt;/TD&gt;&lt;TD&gt;785-158&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468002&lt;/TD&gt;&lt;TD&gt;648-427&lt;/TD&gt;&lt;TD&gt;58&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468002&lt;/TD&gt;&lt;TD&gt;124-462&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468003&lt;/TD&gt;&lt;TD&gt;127-752&lt;/TD&gt;&lt;TD&gt;960&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468003&lt;/TD&gt;&lt;TD&gt;129-452&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468004&lt;/TD&gt;&lt;TD&gt;124-475&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468004&lt;/TD&gt;&lt;TD&gt;123-478&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Items&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Item No&lt;/TD&gt;&lt;TD&gt;Item Category&lt;/TD&gt;&lt;TD&gt;Weight&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100-101&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;200-205&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;300-404&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;785-158&lt;/TD&gt;&lt;TD&gt;68&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;648-427&lt;/TD&gt;&lt;TD&gt;BC&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;124-462&lt;/TD&gt;&lt;TD&gt;41&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;127-752&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;129-452&lt;/TD&gt;&lt;TD&gt;RA&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;124-475&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123-478&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The wanted result is that only these transactions are viewed after the filter is applied:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Invoice No&lt;/TD&gt;&lt;TD&gt;Item No&lt;/TD&gt;&lt;TD&gt;Qty&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;100-101&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;200-205&lt;/TD&gt;&lt;TD&gt;790&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;468001&lt;/TD&gt;&lt;TD&gt;300-404&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 10:12:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2325243#M58187</guid>
      <dc:creator>Plin0987</dc:creator>
      <dc:date>2022-02-08T10:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2326503#M58282</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297266" data-lia-user-login="Plin0987" class="lia-mention lia-mention-user"&gt;Plin0987&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about using the filter pane and adding your filter requirements there?&lt;BR /&gt;&lt;BR /&gt;Or do you need a special measure for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.tackytech.blog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.instagram.com/tackytechtom&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 21:00:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2326503#M58282</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-02-08T21:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2327544#M58331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="353745" data-lia-user-login="tackytechtom" class="lia-mention lia-mention-user"&gt;tackytechtom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still taking my first baby steps with Power BI but if I understand it correctly, using the filter pane would only allow me to filter on transaction level (sales details) in this case? However, yes I would like to have it as a measure to do further visualisations. The measure would calculate if the order was transported by a full trailer directly from the distributor to customer or if the customer bought smaller volumes from our local site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to sum it at the Invoice No level. For example, the wanted result for Invoice No 468001 that I posted at the end would sum up to 150 + 19.750 + 400 = 20.300 and all of these items are within the Item Category "43".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure there are posted solutions somewhere but being new to DAX and being non-English native speaker, I'm yet a bit lost with what keywords to use. My aim is to level up to par with my google skills within excel &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 07:49:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2327544#M58331</guid>
      <dc:creator>Plin0987</dc:creator>
      <dc:date>2022-02-09T07:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2329120#M58443</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297266" data-lia-user-login="Plin0987" class="lia-mention lia-mention-user"&gt;Plin0987&lt;/a&gt;&amp;nbsp;,&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;I got there in two steps.&lt;BR /&gt;First, I created a calculated column called TotalWeight, where the total weight per Invoice Number is created:&lt;/P&gt;&lt;PRE&gt;TotalWeight = 
CALCULATE ( 
    SUMX ( 'Table12_SalesDetails', 'Table12_SalesDetails'[Qty] * RELATED ( 'Table12_Items'[Weight] ) ), 
    ALLEXCEPT ( Table12_SalesDetails,Table12_SalesDetails[Document No] ) 
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From there, it was pretty easy to create a measure that displays the QTY with your constraints:&lt;/P&gt;&lt;PRE&gt;TomsMeasure12 = 
CALCULATE ( 
    SUM (Table12_SalesDetails[Qty]), 
    Table12_Items[Item Category] = "43", 
    Table12_SalesDetails[TotalWeight] &amp;gt; 20000
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this work for you now? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.tackytech.blog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.instagram.com/tackytechtom&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 20:16:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2329120#M58443</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-02-09T20:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2329969#M58499</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297266" data-lia-user-login="Plin0987" class="lia-mention lia-mention-user"&gt;Plin0987&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here is the solution exactly as you wish using a measure&amp;nbsp;&lt;A href="https://www.dropbox.com/t/lNGNxYZvB6Hao1Sn" target="_blank"&gt;https://www.dropbox.com/t/lNGNxYZvB6Hao1Sn&lt;/A&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Please let me know if you have any further requirements.&lt;BR /&gt;If my reply fulfills your requirement, kindly mark itas accepted solution. Kudos are allways appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 06:27:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2329969#M58499</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-10T06:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2337780#M58938</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="353745" data-lia-user-login="tackytechtom" class="lia-mention lia-mention-user"&gt;tackytechtom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That did help me. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 19:32:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2337780#M58938</guid>
      <dc:creator>Plin0987</dc:creator>
      <dc:date>2022-02-14T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2337922#M58943</link>
      <description>&lt;P&gt;Thanks for your reply&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It did show the wanted results in the PBI you attached, but I get an error when applying it to my model. I looked at it for quite a while and then tried to replicate your model with the simplified data but still I ended up getting the same error message in the simplified model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message I get when trying to add "Total Qty"-measure to the matrix is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"MdxScript(Model) (191, 41) Calculation error in measure 'Sales Details'[Total Weight]: A table of multiple values was supplied where a single value was expected."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll post the measures made by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; &amp;nbsp;in case the link is gone and someone else might be helped/inspired by it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Weight = 
VAR CurrentInvoiceNo = VALUES ( SalesHeader[Invoice No] )
VAR TotalInvoiceWeight =
    CALCULATE (
        SUMX (
            SalesDetail,
            SalesDetail[Qty] * RELATED ( Items[Weight] )
        ),
        SalesDetail[Document No] = CurrentInvoiceNo,
        REMOVEFILTERS ( Items )
    )
VAR Result =
    IF ( 
        TotalInvoiceWeight &amp;gt;= 20000,
        TotalInvoiceWeight
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty = 
    IF (
        NOT ISBLANK ( [Total Weight] ),
        SUM ( SalesDetail[Qty] )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 14 Feb 2022 21:37:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-with-multiple-criteria/m-p/2337922#M58943</guid>
      <dc:creator>Plin0987</dc:creator>
      <dc:date>2022-02-14T21:37:56Z</dc:date>
    </item>
  </channel>
</rss>

