<?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: Aggregate on Invoice Header level, then filter on the aggregated value. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084891#M107745</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Please find attached sample file with the solution&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Invoice Total &amp;gt; 15 = 
SUMX ( 
    VALUES ( 'Sales'[Invoice] ),
    VAR CurrentInvoiceValue =
        CALCULATE ( 
            SUM ( 'Sales'[Value] ),
            'Sales'[Artikle] &amp;lt;&amp;gt; "Shipping"
        )
    RETURN
        IF ( 
            CurrentInvoiceValue &amp;gt; 15, 
            CurrentInvoiceValue
        )
)&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 17 Feb 2023 11:23:49 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-02-17T11:23:49Z</dc:date>
    <item>
      <title>Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084698#M107719</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fairly new to DAX, and have been fighting with this problem for days now, also trying to find a solution on the internet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that this problem is probably quite easy and I'm just thinking too complicated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&g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gt;&lt;P&gt;I want to aggregate the invoice total, but without shipping cost (product cost only), and then show the product cost of all invoices above/below a certain values. i.e. Show the total (without shipping) of all invoices with a product value of &amp;gt; 15. Which here would be 55 (=30 from A and 25 from B).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I've started by creating a measure for the total without shipping, but then fail to use it as a filter:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Total_product_cost_belowX =&amp;nbsp;&lt;BR /&gt;var ProductCost = CALCULATE(SUMX(VALUES(Sales[Invoice]),Sales[Value]),Sales[Artikle] &amp;lt;&amp;gt;"Shipping") // works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from here...?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 09:13:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084698#M107719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-17T09:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084751#M107729</link>
      <description>&lt;P&gt;One approach would be to create a summary table in the model, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Invoice Summary =
ADDCOLUMNS (
    DISTINCT ( 'Table'[Invoice] ),
    "Sales amount", [Total_product_cost_belowX]
)
&lt;/LI-CODE&gt;
&lt;P&gt;You could then create measures and filters against this new table.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 09:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084751#M107729</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-02-17T09:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084752#M107730</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;When you say "&lt;SPAN&gt;&lt;EM&gt;of all invoices with a product value of &amp;gt; 15.&lt;/EM&gt;" what do you exactly mean? Please clarify.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 09:41:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084752#M107730</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-17T09:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084863#M107740</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;tamerj1,&lt;/SPAN&gt; each invoice has in the article column real products (XX, YY, ZZ..) but also an item "shipping".&amp;nbsp;&lt;/P&gt;&lt;P&gt;With product value I mean the invoice total minus the shipping cost.&amp;nbsp;&lt;BR /&gt;So for invoice A the invoice total would be 35, but the product value is only 30.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Important: I can't just hard code to substract 5, as shipping costs are different in my real world application.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope that clarifies it.&lt;BR /&gt;Best, nuclePBI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 11:05:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084863#M107740</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-17T11:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084891#M107745</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Please find attached sample file with the solution&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Invoice Total &amp;gt; 15 = 
SUMX ( 
    VALUES ( 'Sales'[Invoice] ),
    VAR CurrentInvoiceValue =
        CALCULATE ( 
            SUM ( 'Sales'[Value] ),
            'Sales'[Artikle] &amp;lt;&amp;gt; "Shipping"
        )
    RETURN
        IF ( 
            CurrentInvoiceValue &amp;gt; 15, 
            CurrentInvoiceValue
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 17 Feb 2023 11:23:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3084891#M107745</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-17T11:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate on Invoice Header level, then filter on the aggregated value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3085145#M107770</link>
      <description>&lt;P&gt;Works perfectly, thanks a ton&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;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 14:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aggregate-on-Invoice-Header-level-then-filter-on-the-aggregated/m-p/3085145#M107770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-17T14:18:38Z</dc:date>
    </item>
  </channel>
</rss>

