<?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: SUMMARAZE performance / early materialization in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3142602#M112257</link>
    <description>&lt;P&gt;Solved by creating additional columns with a sign 1/0 and a simple Calculate (sum(),flag=1)&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 14:13:20 GMT</pubDate>
    <dc:creator>AlexOakman</dc:creator>
    <dc:date>2023-03-20T14:13:20Z</dc:date>
    <item>
      <title>SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3130694#M111388</link>
      <description>&lt;P&gt;Hi, I have a large fact table. I need to calculate a tricky measure. The first step I need to group this table by a certain set of attributes, excluding repetitions, and then find the sum over the resulting table.&amp;nbsp;I use this measure in detailing cumulative dates by month.&amp;nbsp;&lt;BR /&gt;An example of dax:&lt;/P&gt;&lt;P&gt;'&lt;span class="lia-unicode-emoji" title=":bar_chart:"&gt;📊&lt;/span&gt;Measure'[TEST_v1] =&lt;/P&gt;&lt;P&gt;VAR _min = SELECTEDVALUE('Dim date'[firstdate_of_month_key],99999999)&lt;BR /&gt;VAR _max = MAX('Dim date'[date_key])&lt;/P&gt;&lt;P&gt;VAR _tbl2 =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;CALCULATETABLE( 'Test_balance', KEEPFILTERS('Test_balance'[date_key]&amp;gt;=_min&amp;amp;&amp;amp;'Test_balance'[date_key]&amp;lt;=_max),REMOVEFILTERS('Dim date')),&lt;BR /&gt;'bridge_dpd_addition'[dpd_group_company],&lt;BR /&gt;'Test_balance'[prolongation_num_cumulative],&lt;BR /&gt;'Test_balance'[amount_usd]&lt;BR /&gt;),&lt;BR /&gt;"cnt", CALCULATE(DISTINCTCOUNT('Test_balance'[credit_key] ),KEEPFILTERS('Test_balance'[date_key]&amp;gt;=_min&amp;amp;&amp;amp;'Test_balance'[date_key]&amp;lt;=_max),REMOVEFILTERS('Dim date'))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _res = SUMX(_tbl2,[amount_usd]*[cnt])&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;_res&lt;BR /&gt;-------------------------&lt;BR /&gt;or _v2 instead of a _tbl2 I can use&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; _tbl1 = &lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;'Test_balance'&lt;/SPAN&gt;, &lt;SPAN&gt;KEEPFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Test_balance'[date_key]&lt;/SPAN&gt;&amp;gt;=_min&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;'Test_balance'[date_key]&lt;/SPAN&gt;&amp;lt;=_max&lt;SPAN&gt;)&lt;/SPAN&gt;,&lt;SPAN&gt;REMOVEFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Test_balance'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;'bridge_dpd_addition'[dpd_group_company]&lt;/SPAN&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;'Test_balance'[prolongation_num_cumulative]&lt;/SPAN&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;'Test_balance'[amount_usd]&lt;/SPAN&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;'Test_balance'[credit_key]&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; _res =&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;_tbl1,&lt;SPAN&gt;[amount_usd]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;But in both cases I have early materialization of the data. Is there any way to avoid this?&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 12:31:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3130694#M111388</guid>
      <dc:creator>AlexOakman</dc:creator>
      <dc:date>2023-03-14T12:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3131203#M111428</link>
      <description>&lt;P&gt;If you have a relationship from your date table to the fact table then there is no need to apply the date filters to your fact table and you could simplify the code to&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TEST_v1 =
VAR _tbl2 =
    ADDCOLUMNS (
        SUMMARIZE (
            'Test_balance',
            'bridge_dpd_addition'[dpd_group_company],
            'Test_balance'[prolongation_num_cumulative],
            'Test_balance'[amount_usd]
        ),
        "cnt", CALCULATE ( DISTINCTCOUNT ( 'Test_balance'[credit_key] ) )
    )
VAR _res =
    SUMX ( _tbl2, [amount_usd] * [cnt] )
RETURN
    _res
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 14 Mar 2023 15:36:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3131203#M111428</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-03-14T15:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3131616#M111452</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="492622" data-lia-user-login="AlexOakman" class="lia-mention lia-mention-user"&gt;AlexOakman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also try&lt;/P&gt;
&lt;P&gt;TEST_v1 =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Dim date'[firstdate_of_month_key] ),&lt;BR /&gt;VAR _min = 'Dim date'[firstdate_of_month_key]&lt;BR /&gt;VAR _max =&lt;BR /&gt;CALCULATE ( MAX ( 'Dim date'[date_key] ) )&lt;BR /&gt;VAR _tbl1 =&lt;BR /&gt;FILTER (&lt;BR /&gt;CALCULATETABLE ( 'Test_balance', ALL ( 'Test_balance' ) ),&lt;BR /&gt;'Test_balance'[date_key] &amp;gt;= _min&lt;BR /&gt;&amp;amp;&amp;amp; 'Test_balance'[date_key] &amp;lt;= _max&lt;BR /&gt;)&lt;BR /&gt;VAR _tbl2 =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;_tbl1,&lt;BR /&gt;'bridge_dpd_addition'[dpd_group_company],&lt;BR /&gt;'Test_balance'[prolongation_num_cumulative],&lt;BR /&gt;'Test_balance'[amount_usd],&lt;BR /&gt;'Test_balance'[credit_key]&lt;BR /&gt;)&lt;BR /&gt;VAR _res =&lt;BR /&gt;SUMX ( _tbl2, [amount_usd] )&lt;BR /&gt;RETURN&lt;BR /&gt;_res&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 17:45:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3131616#M111452</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-14T17:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3132670#M111518</link>
      <description>&lt;P&gt;I need to calculate cumulative values for the month by day.&amp;nbsp;Something like that:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 06:57:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3132670#M111518</guid>
      <dc:creator>AlexOakman</dc:creator>
      <dc:date>2023-03-15T06:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3132673#M111519</link>
      <description>&lt;P&gt;Thanks for the advice. Unfortunately the result is the same as for ADDCOLUMN(SUMMARAZE(...)) =(&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 07:01:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3132673#M111519</guid>
      <dc:creator>AlexOakman</dc:creator>
      <dc:date>2023-03-15T07:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARAZE performance / early materialization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3142602#M112257</link>
      <description>&lt;P&gt;Solved by creating additional columns with a sign 1/0 and a simple Calculate (sum(),flag=1)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 14:13:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARAZE-performance-early-materialization/m-p/3142602#M112257</guid>
      <dc:creator>AlexOakman</dc:creator>
      <dc:date>2023-03-20T14:13:20Z</dc:date>
    </item>
  </channel>
</rss>

