<?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: Sequence of Applied Filter Context in SUMMARIZECOLUMNS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222927#M117895</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="41" data-lia-user-login="marcorusso" class="lia-mention lia-mention-user"&gt;marcorusso&lt;/a&gt;, any insight you can provide? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 23:05:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-05-05T23:05:37Z</dc:date>
    <item>
      <title>Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222490#M117836</link>
      <description>&lt;P&gt;Hello, I'm struggling to understand the order of operations for how filters are being applied by SUMMARIZECOLUMNS. From the content in the &lt;EM&gt;DGTD&lt;/EM&gt;, we're given the idea that the behavior of SUMMARIZECOLUMNS in how it applies the FilterTable argument is somewhat similar to how CALCULATE works. However, I haven't seen any delineated &lt;U&gt;sequence&lt;/U&gt; of behavior for how filters are applied, like what we have for CALCULATE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example based on Contoso is below and can be run in &lt;A href="http://dax.do" target="_self"&gt;dax.do&lt;/A&gt;. Specifically, in "Sales with Calculate" below, it seems that, in the first row of the resulting table, CALCULATE's context transition is causing "Red" &amp;amp; "White" to overwrite "Red" in Product[Color]. This is a familiar concern especially when working with arbitrarily shaped sets. However, &lt;STRONG&gt;I'm struggling to understand how VALUES ( Product[Color] ) is able to see both colors in the context, given that the GroupBy_ColumnName only contains one color per row and also given the fact that the similar clause ( VALUES ( Product[Color] ) ) in "Sales Amount" apparently only retrieves one color per row.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing? Any tips are greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. &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;LI-CODE lang="markup"&gt;// This is the query I'm struggling with.

EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Color],
    TREATAS (
        { ( "CY 2008", "Red" ), ( "CY 2007", "White" ) },
        'Date'[Calendar Year],
        'Product'[Color]
    ),
    "Sales Amount",
        SUMX (
            VALUES ( Product[Color] ),
            SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] )
        ),
    "Sales With Calculate",
        SUMX (
            VALUES ( Product[Color] ),
            CALCULATE ( SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] ) )
        )
)
ORDER BY [Sales Amount] DESC


// This query for reference to see the values being combined

EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Color],
    'Date'[Calendar Year],
    TREATAS ( { "CY 2008", "CY 2007" }, 'Date'[Calendar Year] ),
    TREATAS ( { "Red", "White" }, 'Product'[Color] ),
    "Sales Amount",
        SUMX (
            VALUES ( Product[Color] ),
            SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] )
        ),
    "Sales with Calculate",
        SUMX (
            VALUES ( Product[Color] ),
            CALCULATE ( SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] ) )
        )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 15:33:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222490#M117836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-05T15:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222540#M117844</link>
      <description>&lt;P&gt;SQLBI have a great video explaining this -&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=bGVLguWf4Ls" target="_blank"&gt;https://www.youtube.com/watch?v=bGVLguWf4Ls&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use KEEPFILTERS you get the correct result&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Color],
    TREATAS (
        { ( "CY 2008", "Red" ), ( "CY 2007", "White" ) },
        'Date'[Calendar Year],
        'Product'[Color]
    ),
    "Sales Amount",
        SUMX (
            VALUES ( Product[Color] ),
            SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] )
        ),
    "Sales With Calculate",
        SUMX (
            VALUES ( Product[Color] ),
            CALCULATE ( SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] ) )
        ),
    "Sales With Calculate KEEP",
        SUMX (
            KEEPFILTERS(VALUES ( Product[Color] ) ),
            CALCULATE ( SUMX ( 'Sales', Sales[Net Price] * Sales[Quantity] ) )
        )
)
ORDER BY [Sales Amount] DESC&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 05 May 2023 15:56:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222540#M117844</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-05-05T15:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222549#M117849</link>
      <description>&lt;P&gt;Thanks John, yes, that's a great video. However, my question is about how SUMMARIZECOLUMNS is creating the values we see.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't explain how we can get "Sales with Calculate," and that's what I'm trying to understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 16:01:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222549#M117849</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-05T16:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222573#M117855</link>
      <description>&lt;P&gt;I think its the same as in the video. When the White row is being evaluated the filter context contains 2007 and white. Somehow, and I can't quite put my finger on how, applying VALUES is overriding the white part of the filter context with both white and red, but it is leaving 2007 in the filter context, so the numbers shown are the values for white &amp;amp; red in 2007. Similarly, for red the values shown are for white and red in 2008.&lt;/P&gt;
&lt;P&gt;I can't quite get how VALUES is getting the outer filter context, containing white &amp;amp; red, when white alone is in the filter context.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 16:30:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222573#M117855</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-05-05T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222926#M117894</link>
      <description>&lt;P&gt;Yes, somehow, the presence of CALCULATE seems to be inflencing what VALUES can see in the context (I don't think that's what's happening, but that's just how it looks.). This is wha I can't wrap my head around.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 23:04:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222926#M117894</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-05T23:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222927#M117895</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="41" data-lia-user-login="marcorusso" class="lia-mention lia-mention-user"&gt;marcorusso&lt;/a&gt;, any insight you can provide? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 23:05:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3222927#M117895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-05T23:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3223050#M117908</link>
      <description>&lt;P&gt;Read the article!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/when-to-use-keepfilters-over-iterators/" target="_blank"&gt;When to use KEEPFILTERS over iterators - SQLBI&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2023 05:08:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3223050#M117908</guid>
      <dc:creator>marcorusso</dc:creator>
      <dc:date>2023-05-06T05:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sequence of Applied Filter Context in SUMMARIZECOLUMNS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3286673#M122216</link>
      <description>&lt;P&gt;Per Alberto Ferrari, the behavior observed and described here is due to a bug in the optimizer. See the comments on the page&amp;nbsp;&lt;A href="http://disq.us/p/2uo3x4r" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 20:13:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sequence-of-Applied-Filter-Context-in-SUMMARIZECOLUMNS/m-p/3286673#M122216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-15T20:13:22Z</dc:date>
    </item>
  </channel>
</rss>

