<?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 about evaluation context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144371#M164707</link>
    <description>&lt;P&gt;there is an example in Microsoft training modules&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/training/modules/dax-power-bi-iterator-functions/2-aggregation-iterator-functions" target="_self"&gt;2-aggregation-iterator-functions&lt;/A&gt;&amp;nbsp;. and in the higher grain summarization part, it gives a formula:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order =
AVERAGEX(
    VALUES('Sales Order'[Sales Order]),
    [Revenue]
)&lt;/LI-CODE&gt;&lt;P&gt;where [Revenue] is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue =
SUMX(
    Sales,
    Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
)&lt;/LI-CODE&gt;&lt;P&gt;lets put them together:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order =
AVERAGEX(
    VALUES('Sales Order'[Sales Order]),
    SUMX(
      Sales,
      Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;my question is:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;is the formula above the same as this one? why?&lt;/P&gt;&lt;P&gt;(I test these two formulas and find them return the same result in my data model. )&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order2 =
AVERAGEX (
    VALUES('Sales Order'[Sales Order]),
    SUMX (
        FILTER(Sales, Sales[Sales Order] = EARLIER('Sales Order'[Sales Order])),
        Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2024 07:54:54 GMT</pubDate>
    <dc:creator>qqqube</dc:creator>
    <dc:date>2024-09-11T07:54:54Z</dc:date>
    <item>
      <title>about evaluation context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144371#M164707</link>
      <description>&lt;P&gt;there is an example in Microsoft training modules&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/training/modules/dax-power-bi-iterator-functions/2-aggregation-iterator-functions" target="_self"&gt;2-aggregation-iterator-functions&lt;/A&gt;&amp;nbsp;. and in the higher grain summarization part, it gives a formula:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order =
AVERAGEX(
    VALUES('Sales Order'[Sales Order]),
    [Revenue]
)&lt;/LI-CODE&gt;&lt;P&gt;where [Revenue] is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue =
SUMX(
    Sales,
    Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
)&lt;/LI-CODE&gt;&lt;P&gt;lets put them together:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order =
AVERAGEX(
    VALUES('Sales Order'[Sales Order]),
    SUMX(
      Sales,
      Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;my question is:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;is the formula above the same as this one? why?&lt;/P&gt;&lt;P&gt;(I test these two formulas and find them return the same result in my data model. )&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue Avg Order2 =
AVERAGEX (
    VALUES('Sales Order'[Sales Order]),
    SUMX (
        FILTER(Sales, Sales[Sales Order] = EARLIER('Sales Order'[Sales Order])),
        Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 07:54:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144371#M164707</guid>
      <dc:creator>qqqube</dc:creator>
      <dc:date>2024-09-11T07:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: about evaluation context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144460#M164712</link>
      <description>&lt;P&gt;chatgpt gives an answer as follows:&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Execute SUMX&lt;/STRONG&gt;&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;For each Sales Order, AVERAGEX passes the current Sales Order as the row context and evaluates the SUMX function.&lt;/LI&gt;&lt;LI&gt;SUMX(Sales, ...) iterates over the Sales table. However, because DAX applies the current row context automatically, the SUMX will only process rows in the Sales table that match the current Sales Order.&lt;/LI&gt;&lt;LI&gt;This is due to DAX’s context propagation, where the outer row context (in this case, the current Sales Order) is passed into the inner calculation, so SUMX operates only on rows that match the Sales Order.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 11 Sep 2024 08:26:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144460#M164712</guid>
      <dc:creator>qqqube</dc:creator>
      <dc:date>2024-09-11T08:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: about evaluation context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144737#M164723</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="804614" data-lia-user-login="qqqube" class="lia-mention lia-mention-user"&gt;qqqube&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes,&amp;nbsp;Both formulas will give the same result but DAX automatically handles the filter context efficiently in Formula 1..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you find this helpful , please mark it as solution and &lt;/SPAN&gt;&lt;SPAN&gt;Your Kudos are much appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;Dharmendar S&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/dharmendar-s-b5b43463/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LinkedIN&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 10:51:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/about-evaluation-context/m-p/4144737#M164723</guid>
      <dc:creator>dharmendars007</dc:creator>
      <dc:date>2024-09-11T10:51:02Z</dc:date>
    </item>
  </channel>
</rss>

