<?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: No CACULATE challenge in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147846#M112682</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales Amount (Delivered) NC = 
    VAR __Dates = SELECTCOLUMNS('Calendar',"DateKey",[DateKey])
    VAR __Table = FILTER(ALLSELECTED('Sales'), [DeliveredDateKey] IN __Dates)
    VAR __Result = SUMX(__Table, [SalesAmount])
RETURN
    __Result&lt;/LI-CODE&gt;
&lt;P&gt;In my testing the measures return within 50 milliseconds of one another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 17:20:26 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2023-03-22T17:20:26Z</dc:date>
    <item>
      <title>No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147810#M112679</link>
      <description>&lt;P&gt;For those haters of CALCULATE like&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;, I challenge you to create a measure without CALCULATE that performs anywhere close to the same speed as this very simple measure that switches to an inactive relationship. It must also not break if a simple filter from any of the dimension tables is applied.&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;LI-CODE lang="php"&gt;Sales Amount (Delivered) = 
CALCULATE (
    SUM ( Sales[SalesAmount] ),
    USERELATIONSHIP ( Sales[DeliveredDateKey], 'Calendar'[DateKey] )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the attached file.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Report preview:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;As expected, we can see that sales during periods without a discount promotion have products delivered in promotion months.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 16:46:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147810#M112679</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2023-03-22T16:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147846#M112682</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales Amount (Delivered) NC = 
    VAR __Dates = SELECTCOLUMNS('Calendar',"DateKey",[DateKey])
    VAR __Table = FILTER(ALLSELECTED('Sales'), [DeliveredDateKey] IN __Dates)
    VAR __Result = SUMX(__Table, [SalesAmount])
RETURN
    __Result&lt;/LI-CODE&gt;
&lt;P&gt;In my testing the measures return within 50 milliseconds of one another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 17:20:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147846#M112682</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-22T17:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147959#M112687</link>
      <description>&lt;P&gt;Nice!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now try it without the slicer filtering and see how the performance compares. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:01:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3147959#M112687</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2023-03-22T18:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148010#M112690</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;This one doesn't use CALCULATE either (LOL!) and is actually 3 times faster than the original measure from a DAX Query perspective.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NC3 = 
 VAR __Table = CALCULATETABLE('Sales', USERELATIONSHIP ( Sales[DeliveredDateKey], 'Calendar'[DateKey] ))
 VAR __Result = SUMX(__Table, [SalesAmount])
RETURN
 __Result&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:16:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148010#M112690</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-22T18:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148030#M112696</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:22:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148030#M112696</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-22T18:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148147#M112703</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;Ha! The performance of that is the same as my CALCULATE version in my testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a final challenge, see if you can write a cumulative version without CALCULATE or CALCULATETABLE that refreshes in under 10 seconds with no slicer filtering. The CALCULATE version refreshes in about 0.2 sec, including all the overhead:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Cumulative Sales Amount (Delivered) = 
VAR _MaxDate = MAX ( 'Calendar'[DateKey] )
VAR _Result =
    CALCULATE (
        SUM ( Sales[SalesAmount] ),
        USERELATIONSHIP ( Sales[DeliveredDateKey], 'Calendar'[DateKey] ),
        ALL ( 'Calendar' ),
        'Calendar'[DateKey] &amp;lt;= _MaxDate
    )
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 20:17:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148147#M112703</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2023-03-22T20:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148563#M112724</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;It's a good more or less single use case where CALCULATE is beneficial but really just because USERELATIONSHIP was coded to work with CALCULATE. USERELATIONSHIP could have been coded to support FILTER as well. It's not really CALCULATE, it's the additional functions that were coded to work with CALCULATE. But, there are plenty of examples of the reverse. Try writing a version of these with only using CALCULATE and no X aggregator that A. Actually works and B. Performs significantly faster.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write a running total measure that uses a single table data model only using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write a working measure total for a semi-additive measure using only CALCULATE and no X aggregator.&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/td-p/547907" target="_blank" rel="noopener"&gt;Measure Totals, The Final Word - Microsoft Power BI Community&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Write a version of &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364" target="_self"&gt;Open Tickets&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/De-Seasonalized-Correlation-Coefficient/td-p/337829" target="_self"&gt;Deseasonalized Correlation Coefficient&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/td-p/367362" target="_self"&gt;Net Work Days&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/td-p/247439" target="_self"&gt;Simple Linear Regression&lt;/A&gt; measure formula using only CALULATE and n X aggregator&lt;/LI&gt;
&lt;LI&gt;Write &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739" target="_self"&gt;Cthulhu&lt;/A&gt; using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write an &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Mean-Time-Between-Failure-MTBF/m-p/625082#M304" target="_self"&gt;MTBF&lt;/A&gt; measure using CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/While-Loop/td-p/637535" target="_self"&gt;While loop&lt;/A&gt; measure using CALCULATE&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/For-Loop/td-p/637531" target="_self"&gt;For loop&lt;/A&gt; measure using CALCULATE&lt;/LI&gt;
&lt;LI&gt;Write a &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Days-of-Supply/td-p/635656" target="_self"&gt;Days of Supply&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Hour-Breakdown/td-p/625085" target="_self"&gt;Hour Breakdown&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814" target="_self"&gt;Lookup Value&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;LI&gt;Write &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Overworked/td-p/963336" target="_self"&gt;Overworked&lt;/A&gt; measure using only CALCULATE and no X aggregator&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I could go on, I only got through 3 pages of 11 of the Quick Measure Gallery.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The point here is the the No CALCULATE approach is a far better and more flexible approach to writing DAX that allows you to solve real-world problems, problems that CALCULATE could never hope to touch. Yes, there are times when CALCULATE is a good idea for one reason or another. But, this fixation the DAX community has on CALCULATE is unhealthy. It makes DAX harder to learn and breeds this crazy culture where people want to use it everywhere when it is simply making their lives harder and is absolutely unnecessary the vast majority of the time when the simple approach of:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create some VAR's&lt;/LI&gt;
&lt;LI&gt;Create a Table VAR&lt;/LI&gt;
&lt;LI&gt;X Aggregator&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Will solve the VAST majority of problems in DAX without ever needing CALCULATE. Simple. No reason to worry about the internal workings of CALCULATE or context transition or pretty much any of the stuff that people find "hard" about DAX.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 01:43:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148563#M112724</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-23T01:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148862#M112746</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp; &amp;amp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This one uses neither CALCULATE nor CALCULATETABLE and performs faster than the original one&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Sales Amount (Delivered) 2 = 
VAR SelectedSales = ALLSELECTED ( Sales )
VAR SummarySales = 
    SUMMARIZE ( 
        SelectedSales, 
        Sales[DeliveredDateKey],
        "@SalesAnount", SUM ( Sales[SalesAmount] ) 
    )
RETURN
    SUMX ( 
        VALUES ( 'Calendar'[DateKey] ),
        VAR FilteredSales = FILTER ( SummarySales, [DeliveredDateKey] = 'Calendar'[DateKey] ) 
        RETURN
            SUMX ( FilteredSales, [@SalesAnount] )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 05:26:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148862#M112746</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T05:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148884#M112747</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here you go&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Cumulative Sales Amount (Delivered) 2 = 
VAR SelectedSales = ALLSELECTED ( Sales )
VAR SummarySales = 
    SUMMARIZE ( 
        SelectedSales, 
        Sales[DeliveredDateKey],
        "@SalesAnount", SUM ( Sales[SalesAmount] ) 
    )
VAR SummaryDates =
    SUMMARIZE ( 
        'Calendar',
        'Calendar'[Year],
        'Calendar'[MonthName],
        "@MaxDate", MAX ( 'Calendar'[DateKey] )
    )
RETURN
    SUMX ( 
        SummaryDates,
        VAR FilteredSales = FILTER ( SummarySales, [DeliveredDateKey] &amp;lt;= [@MaxDate] ) 
        RETURN
            SUMX ( FilteredSales, [@SalesAnount] )
    )&lt;/LI-CODE&gt;
&lt;P&gt;This is faster than yours. I guess&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;has a very good point&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 05:45:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3148884#M112747</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T05:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149291#M112765</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Totally agree&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 09:18:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149291#M112765</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T09:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149803#M112799</link>
      <description>&lt;P&gt;&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;Wow! Super impressive! That is lightning fast!! I ran 10-15 tests and your version has DAX query timing that is on average 2-3 times faster than CALCULATE ( ~75 milliseconds versus ~200 milliseconds.&amp;nbsp; Overall time was consistently 100 milliseconds faster.&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The technique also works for the original problem and performs almost identically to the CALCULATE version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NC4 = 
    VAR __SelectedSales = ALLSELECTED( 'Sales' )
    VAR __SummarySales = 
        SUMMARIZE(
            __SelectedSales,
            [DeliveredDateKey],
            "__SalesAmount", SUM( [SalesAmount] )
        )
    VAR __Dates = DISTINCT('Calendar'[DateKey])
    VAR __Result = 
        SUMX( FILTER( __SummarySales, [DeliveredDateKey] IN __Dates), [__SalesAmount])
RETURN&lt;/LI-CODE&gt;
&lt;P&gt;Once again, CALCULATE goes down in defeat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 12:24:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149803#M112799</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-23T12:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149846#M112800</link>
      <description>&lt;P&gt;&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;One other thing, on a whim decided to replace SUMMARIZE with GROUPBY. SUMMARIZE is waaaaaayyyy more performant than GROUPBY. Like orders of magnitude more performant.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 12:32:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149846#M112800</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-23T12:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149880#M112802</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be honest somehow I cheated &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I couldn't do that without context transition so I thought ok, SUMMARIZE can do that as well. Yes indeed GROUPBY does not perform context transition therefore would perform slower in this case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 12:40:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149880#M112802</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T12:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149888#M112803</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes I actually placed the solution of the first problem in a separate reply right before the the solution of the 2nd problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 12:42:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149888#M112803</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T12:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149955#M112807</link>
      <description>&lt;P&gt;&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;Somehow I missed that, the way these forums do threading is mildly infuriating at times.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3149955#M112807</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-23T13:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150120#M112813</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;X aggregators are absolutely essential. I have no interest in comparing No CALCULATE vs No X aggregator since I'd rather not handicap myself at all.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:53:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150120#M112813</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2023-03-23T13:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150231#M112817</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;Good challenge! I am a Pro CALCULATE but recommend users not to stick with a single side.&amp;nbsp;&lt;BR /&gt;Here are my solutions:&lt;/P&gt;&lt;P&gt;Solution 1 using INNERJOIN, performs in 40ms without any filter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Delivered Amount AS = 
VAR Dates = 
    SELECTCOLUMNS ( 
        VALUES ( 'Calendar'[DateKey] ),
        "DeliveredDateKey", 'Calendar'[DateKey] &amp;amp; ""
    )
VAR SalesByDelivery = 
    SELECTCOLUMNS ( 
        SUMMARIZE ( 
            ALLSELECTED ( Sales ),
            Sales[DeliveredDateKey],
            "Sum", SUM ( Sales[SalesAmount] )
        ),
        "DeliveredDateKey", [DeliveredDateKey] &amp;amp; "",
        "Sales", [Sum]
    )
VAR Result = 
    SUMX ( 
        NATURALINNERJOIN ( Dates, SalesByDelivery ),
        [Sales]
    )
RETURN 
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solution 2 using CONTAINSROW or the IN performs in 23 ms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Delivered Amount AS 2 = 
VAR SalesByDeliveryDate = 
    SUMMARIZE ( 
        ALL ( Sales ),
        Sales[DeliveredDateKey],
        "TotalSales", SUM ( Sales[SalesAmount] )
    )
VAR CurrentYearRows = 
    FILTER ( 
        SalesByDeliveryDate,
        CONTAINSROW (
            VALUES ( 'Calendar'[DateKey] ),
            Sales[DeliveredDateKey]
        )
    )
VAR Result = 
    SUMX ( CurrentYearRows, [TotalSales] )
RETURN 
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cumulative Total - I added a YearMonth column in the Dates table, since we are not showing date level I decided to reduce granularity, takes about 50ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CT DeliveredAmount AS = 
VAR SalesByDelivery = 
    SUMMARIZE ( 
        ALL ( Sales ),
        Sales[DeliveredDateKey],
        "@TotalSales", SUM ( Sales[SalesAmount] ),
        "@YearMonth", YEAR ( Sales[DeliveredDateKey] ) * 100 + MONTH ( Sales[DeliveredDateKey] ) 
    )
VAR Result = 
    SUMX ( 
        FILTER ( 
            SalesByDelivery, 
            [@YearMonth] &amp;lt;= MAX ( 'Calendar'[YearMonth] ) 
        ),
        [@TotalSales]
    )
RETURN 
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&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;I tried and your code and it returns incorrect subtotals.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 14:19:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150231#M112817</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2023-03-23T14:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150288#M112821</link>
      <description>&lt;P&gt;I'm awarding the win to&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;for the original problem. It's about 20ms in testing on my machine instead of 10ms for mine but that's still super fast.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm awarding the win to &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;for the cumulative challenge since that solution works for subtotals as well.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 14:34:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150288#M112821</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2023-03-23T14:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150757#M112842</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;Really impressive! If there is a restriction that you can't change the data model, then this slight tweak works just as well:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Sales Amount (Delivered) AS rev = 
VAR SalesByDelivery = 
    SUMMARIZE ( 
        ALLSELECTED ( Sales ),
        [DeliveredDateKey],
        "@TotalSales", SUM ( [SalesAmount] ),
        "@YearMonth", YEAR ( [DeliveredDateKey] ) * 100 + MONTH ( [DeliveredDateKey] ) 
    )
VAR Result = 
    SUMX ( 
        FILTER ( 
            SalesByDelivery, 
            [@YearMonth] &amp;lt;= MAX ( 'Calendar'[Year] ) * 100 + MAX( 'Calendar'[MonthOfYear])
        ),
        [@TotalSales]
    )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Mar 2023 17:52:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3150757#M112842</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-03-23T17:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: No CACULATE challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3151604#M112886</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Yes you are right I've over looked that but this is an easy fix. The outer SUMX should have been a MAXX&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Cumulative Sales Amount (Delivered) 2 = 
VAR SelectedSales = ALLSELECTED ( Sales )
VAR SummarySales = 
    SUMMARIZE ( 
        SelectedSales, 
        Sales[DeliveredDateKey],
        "@SalesAnount", SUM ( Sales[SalesAmount] ) 
    )
VAR SummaryDates =
    SUMMARIZE ( 
        'Calendar',
        'Calendar'[Year],
        'Calendar'[MonthName],
        "@MaxDate", MAX ( 'Calendar'[DateKey] )
    )
RETURN
    MAXX ( 
        SummaryDates,
        VAR FilteredSales = FILTER ( SummarySales, [DeliveredDateKey] &amp;lt;= [@MaxDate] ) 
        RETURN
            SUMX ( FilteredSales, [@SalesAnount] )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Mar 2023 05:13:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/No-CACULATE-challenge/m-p/3151604#M112886</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-24T05:13:15Z</dc:date>
    </item>
  </channel>
</rss>

