<?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: CALCULATE Challenge - Round 1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3901443#M152033</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;&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;- I see this works faster, but prior year calculation don't solve the Leap Year issue.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 08:08:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-08T08:08:18Z</dc:date>
    <item>
      <title>CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3856830#M150669</link>
      <description>&lt;P&gt;&lt;SPAN&gt;For those haters of No CALCULATE like&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;&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;, I challenge you to create measures with an explicit CALCULATE that for the prescribed scenarios perform anywhere close to the same speed as the very simple No CALCULATE measures that perform date intelligence calculations. Here are the rules:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;Must contain an explicit CALCULATE&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;The explicit CALCULATE must not be superfluous, i.e. CALCULATE(SUM('Table'[Value])) if using SUM('Table'[Value]) would do just fine.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;A sample No CALCULATE measure is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NC Intenet Sales (YTD) = 
    VAR __Date = MAX('Dates'[Date])
    VAR __Year = YEAR(__Date)
    VAR __Table = 
        SUMMARIZE(
            ALL('FactInternetSales'), 
            'FactInternetSales'[OrderDate],
            "__Year", YEAR([OrderDate]),
            "__Sales", SUM('FactInternetSales'[SalesAmount]))
    VAR __Result = SUMX(FILTER(__Table, [__Year] = __Year &amp;amp;&amp;amp; [OrderDate] &amp;lt;= __Date),[__Sales])
RETURN
    __Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The PBIX file is attached below. There are 16 measures for calculating such things as previous year to date, previous month to date, previous week to date, etc. Here is a reference video that also describes the scenario and original performance results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;div data-video-id="https://youtu.be/nUZPk7lpe_Q" data-video-remote-vid="https://youtu.be/nUZPk7lpe_Q" class="lia-video-container lia-media-is-center lia-media-size-medium"&gt;&lt;iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnUZPk7lpe_Q%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnUZPk7lpe_Q&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnUZPk7lpe_Q%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 21:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3856830#M150669</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-05-03T21:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3857404#M150691</link>
      <description>&lt;P&gt;HI&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;,&lt;/P&gt;
&lt;P&gt;Thanks for your sharling, I think these technical research will help other user to understanding how dax calculate.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 06:10:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3857404#M150691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-24T06:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3859903#M150773</link>
      <description>&lt;P&gt;I've noticed the model involved can make a big difference in which approach works best and I don't fully understand why yet, so I'm attaching another (much bigger) model I've been tinkering with for additional comparisons.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 16:02:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3859903#M150773</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-22T16:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3859958#M150774</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;Big difference I see is that the visual doesn't go to the Date granularity, which means it isn't the same scenario.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 16:26:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3859958#M150774</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-22T16:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860212#M150784</link>
      <description>&lt;P&gt;Good point on the granularity. Even matching granularity though, there are still different behaviors between files that I don't understand (in particular, TOTALYTD performs similarly to your measure in Contoso).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 18:31:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860212#M150784</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-22T18:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860366#M150794</link>
      <description>&lt;P&gt;In general you don't want to include the syntax sugar in your tests. Keep to the basic functions.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 20:42:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860366#M150794</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-04-22T20:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860413#M150800</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;I'll have to look closer but both have a data table marked as a date table. The Dates table in Contoso though has significantly less rows in it. Triple in fact.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 21:27:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860413#M150800</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-22T21:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860519#M150810</link>
      <description>&lt;P&gt;There seems to be something pathological going on that's making the query planner do weird things with simpler measures. I'd really like to figure out what as I think that knowledge may be broadly applicable in measure optimization. It should not be doing this (some sort of cross-join?).&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I got the above when using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;VAR _CurrYear = SELECTEDVALUE ( Dates[Year] )
VAR _CurrDate = SELECTEDVALUE ( Dates[Date] )
VAR _Result =
    CALCULATE (
        [Internet Sales],
        Dates[Year] = _CurrYear,
        Dates[Date] &amp;lt;= _CurrDate
    )
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using WINDOW is better but it still has steps with 1.4 million records.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;CALCULATE (
    [Internet Sales],
    WINDOW (
        1, ABS,
        0, REL,
        ORDERBY ( Dates[Year], ASC, Dates[Date], ASC ),
        PARTITIONBY ( Dates[Year] )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can any DAX masters like&amp;nbsp;&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;&amp;nbsp;or&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="503" data-lia-user-login="jeffrey_wang" class="lia-mention lia-mention-user"&gt;jeffrey_wang&lt;/a&gt;&amp;nbsp;shed some light?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 00:03:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860519#M150810</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-23T00:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860590#M150812</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 00:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860590#M150812</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-23T00:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860608#M150814</link>
      <description>&lt;P&gt;I think this should qualify, though it isn't super clean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;VAR _AllDates_ =
    SUMMARIZE (
    	ALL ( FactInternetSales ),
    	Dates[Year],
    	Dates[Date]
    )
VAR _DateRange_ =
    WINDOW (
        1, ABS,
        0, REL,
        _AllDates_,
        ORDERBY ( Dates[Date] ),
        PARTITIONBY ( Dates[Year] )
    )
VAR _Result =  CALCULATE ( [Internet Sales], _DateRange_ )
RETURN
    _Result&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 23 Apr 2024 00:42:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860608#M150814</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-23T00:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860998#M150830</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;I'll have a look in the morning. But if it does work, I mean, thank God it's such an obvious and easy solution that even a DAX novice could understand and doesn't rely on a function introduced within that last year which pretty much means the solution was unsolvable for 7 years or so...&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 03:39:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3860998#M150830</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-23T03:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3861091#M150835</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;Exactly.&lt;BR /&gt;What the formula engine is trying to do is to create the following table:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Date&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Date YTD&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Sum of SalesAmount&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Then it does the aggregation over Date.&lt;/P&gt;
&lt;P&gt;With help of some mathmatics, given that the Date table is 7,670 rows the formula engine would produce a crossjoin table of around (1/2 )* (7,670) * (7,670) = 29,414,450 rows. This is simply the area of a triangle.&lt;BR /&gt;In opttimized versions, the corossjoin is happening to only the dates that do exist in the fact tabe (1,124) rows. That would result in a table of around (1/2 )* (1,124 * (1,124) = 6,316,680 rows.&amp;nbsp;&lt;BR /&gt;This is why the cardinality of the Dates[Date] and&amp;nbsp;FactInternetSales[Order Date] do matter alot.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 05:52:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3861091#M150835</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-04-23T05:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3861115#M150837</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;What the formula engine is trying to do is to create the following table:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Date&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Date YTD&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Sum of SalesAmount&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Then it does the aggregation over Date.&lt;/P&gt;
&lt;P&gt;With help of some mathmatics, given that the Date table is 7,670 rows the formula engine would produce a crossjoin table of around (1/2 )* (7,670) * (7,670) = 29,414,450 rows. This is simply the area of a triangle.&lt;BR /&gt;In opttimized versions, the corossjoin is happening to only the dates that do exist in the fact tabe (1,124) rows. That would result in a table of around (1/2 )* (1,124 * (1,124) = 6,316,680 rows.&amp;nbsp;&lt;BR /&gt;This is why the cardinality of the Dates[Date] and&amp;nbsp;FactInternetSales[Order Date] do matter alot.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Usually I use the Window function following a NoCALCULATE approach by pre-calculating values then pushing all other calculation to the formula engine. For example the following produces the simplist and fastest query plan along with the minimum number of storage engine queries among all other solutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Internet Sales (YTD) Window = 
VAR AllDateSales =
    SUMMARIZE(
        ALL ( FactInternetSales ),
    	Dates[Year], 
        Dates[Date],
        "@Amount", SUM ( FactInternetSales[SalesAmount] )
    )
VAR Result =
    SUMX (
        WINDOW (
            0, ABS,
            0, REL,
            AllDateSales,
            ORDERBY ( Dates[Date] ),
            PARTITIONBY ( Dates[Year] )
        ),
        [@Amount]
    )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would however say that your WINDOW-CALCULATE solution matches the performance of other NoCALCULATE solutions so I vote for it as an acceptable solution.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 14:46:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3861115#M150837</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-04-23T14:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862323#M150880</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;In my testing looking at the DAX query in Performance Analyzer this seems consistently about 40%-50% slower than the fastes No CALCULATE approach. But, we're quibbling over 10's of ms here so I feel like this passes. However, there are still 15 other date intelligence measures in the file that are part of the challenge.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 12:35:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862323#M150880</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-23T12:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862641#M150896</link>
      <description>&lt;BLOCKQUOTE&gt;thank God it's such an obvious and easy solution that even a DAX novice could understand and doesn't rely on a function introduced within that last year which pretty much means the solution was unsolvable for 7 years or so...&lt;/BLOCKQUOTE&gt;
&lt;P&gt;WINDOW isn't required. A plain filter works fine too and has been around since the beginning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;VAR _AllDates_ = SUMMARIZE ( ALL ( FactInternetSales ), Dates[Date]	)
	
VAR _CurrDate = MAX ( Dates[Date] )
VAR _CurrYear = YEAR ( _CurrDate )

VAR _DateRange_ =
    FILTER (
    	_ALLDates_,
    	YEAR ( Dates[Date] )  = _CurrYear &amp;amp;&amp;amp;
    	Dates[Date] &amp;lt;= _CurrDate
    )
VAR _Result =  CALCULATE ( [Internet Sales], _DateRange_ )
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;However, there are still 15 other date intelligence measures in the file that are part of the challenge.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm not really interested in doing all 15 other ones as I don't think they'll reveal much that this YTD example doesn't already. If there is one that you think is meaningfully different, let me know.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 14:10:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862641#M150896</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-23T14:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862785#M150907</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;A bit worse, a little over 50% without WINDOW but still within acceptable limits. I'll take the technique and apply it to the other 15 calculations and let you know if there is an issue. The interesting thing is that if you use a more traditional CALCULATE approach like below, the timing increases to nearly twice that of No CALCULATE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Alexis Olson TYD CALCULATE 3 = 
    VAR _CurrDate = MAX ( Dates[Date] )
    VAR _CurrYear = YEAR ( _CurrDate )
    VAR _Result =  
        CALCULATE ( 
            [Internet Sales], 
            FILTER (
                SUMMARIZE ( ALL ( FactInternetSales ), Dates[Date]	),
                YEAR ( Dates[Date] )  = _CurrYear &amp;amp;&amp;amp;
                Dates[Date] &amp;lt;= _CurrDate
            )
        )
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other interesting thing about this approach is that you are pretty much destroying the star schema or at least not leveraging it in the slightest. You effectively create a new table that includes all rows in the fact table summarized by Date and then create a filter clause over that. So this kind of says to me that the mantra of the star schema coupled with CALCULATE as being the silver bullet for all things DAX is effectively nonsense because you basically have to blow-up the star schema to get CALCULATE to function at any reasonable performance level.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, I don't think it's intuitive that the SUMMARIZEd table includes all dates in it considering the filter context within a row within the table is to a specific date. That seems weird to me although I imagine it is because using SUMMARIZE against ALL of the fact table and then by Date brings all of those dates back into context somehow versus the individual date at the visual row.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 15:03:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862785#M150907</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-23T15:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862815#M150910</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;,&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;&lt;/P&gt;
&lt;P&gt;I would say that both Alex's solutions (WINDOW and SUMMARIZE) look more like a NoCALCULATE approach.&amp;nbsp;&lt;BR /&gt;The only difference is replacing&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUMX ( __TableVar, 'Table'[Column] )&lt;/P&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;CALCULATE ( SUM (&amp;nbsp;&lt;SPAN&gt;'Table'[Column] ),&amp;nbsp;__TableVar )&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;in fact once filter ALL ( 'Table' ) is used, CALCULATE remains there with absolutely no meaning of existence.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 15:13:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862815#M150910</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-04-23T15:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862904#M150913</link>
      <description>&lt;BLOCKQUOTE&gt;The other interesting thing about this approach is that you are pretty much destroying the star schema or at least not leveraging it in the slightest. You effectively create a new table that includes all rows in the fact table summarized by Date and then create a filter clause over that. So this kind of says to me that the mantra of the star schema coupled with CALCULATE as being the silver bullet for all things DAX is effectively nonsense because you basically have to blow-up the star schema to get CALCULATE to function at any reasonable performance level.
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
Finally, I don't think it's intuitive that the SUMMARIZEd table includes all dates in it considering the filter context within a row within the table is to a specific date. That seems weird to me although I imagine it is because using SUMMARIZE against ALL of the fact table and then by Date brings all of those dates back into context somehow versus the individual date at the visual row.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The SUMMARIZE works on the expanded fact table, which leverages the star schema. I find using SUMMARIZE this way useful in many situations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This situation where you have a visual with thousands of rows does indeed seem to be a pathological case for basic CALCULATE patterns. There are other situations where those same patterns will outperform the No CALCULATE approach in the post (see the Contoso example I uploaded, for example). I'd expect Tamer's WINDOW solution to work well broadly.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 15:56:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862904#M150913</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-23T15:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862919#M150914</link>
      <description>&lt;P&gt;Don't forget that the star schema is mostly smoke and mirrors, and that behind the scenes everything is based on expanded tables anyway.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 16:01:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3862919#M150914</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-04-23T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE Challenge - Round 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3863282#M150923</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, hmm, there was that second rule. This formula (below) produces the same result as&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;'s orignal which technically makes the CALCULATE superfluous. That said, the CALCULATE does not JUST wrap a function that would work without it so I think that going strictly by the rules specified Alexis' formula technically meets the specified criteria.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Alexis Olson TYD CALCULATE 4 = 
VAR _AllDates_ = SUMMARIZE ( ALL ( FactInternetSales ), Dates[Date]	)
	
VAR _CurrDate = MAX ( Dates[Date] )
VAR _CurrYear = YEAR ( _CurrDate )

VAR _DateRange_ =
    FILTER (
    	_ALLDates_,
    	YEAR ( Dates[Date] )  = _CurrYear &amp;amp;&amp;amp;
    	Dates[Date] &amp;lt;= _CurrDate
    )
VAR _Result =  SUMX ( _DateRange_, [Internet Sales])
RETURN
    _Result&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 23 Apr 2024 18:51:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-Challenge-Round-1/m-p/3863282#M150923</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-04-23T18:51:05Z</dc:date>
    </item>
  </channel>
</rss>

