<?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 CALCULATE theory test1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3030075#M103516</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Not sure if you can avoid explicitly referencing Type and Subtype in that case. It's an unforunate aspect of CALCULATE mania that Microsoft has created certain functions like REMOVEFILTERS that only work as a filter clause within the CALCULATE function versus just a general filter function like ALL and ALLEXCEPT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;div data-video-id="https://youtu.be/fH0VcV9Smow?t=465" data-video-remote-vid="https://youtu.be/fH0VcV9Smow?t=465" 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%2FfH0VcV9Smow%3Fstart%3D465%26feature%3Doembed%26start%3D465&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfH0VcV9Smow&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FfH0VcV9Smow%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 02:15:36 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2023-01-19T02:15:36Z</dc:date>
    <item>
      <title>NO CALCULATE theory test1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3028126#M103341</link>
      <description>&lt;P&gt;Curious about&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;&amp;nbsp;NO CALCULATE theory&amp;nbsp;(&lt;A href="https://www.youtube.com/watch?v=meh3OkgFYfc&amp;amp;t=6s&amp;amp;ab_channel=MicrosoftHatesGreg" target="_self"&gt;video&lt;/A&gt;, &lt;A href="https://community.powerbi.com/t5/Community-Blog/CALCUHATE-Why-I-Don-t-Use-DAX-s-CALCULATE-Function/ba-p/1248635" target="_self"&gt;article&lt;/A&gt;)&lt;BR /&gt;Looks very atrractive, but needs to test.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example&lt;/STRONG&gt;:&lt;BR /&gt;I want to rank &lt;STRONG&gt;Date&lt;/STRONG&gt; based on all subgroups mentioned in matrix Rows section except &lt;STRONG&gt;Date&lt;/STRONG&gt;.&lt;BR /&gt;Examples&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;So, it means that I want to avoid explicit use of &lt;STRONG&gt;Type&lt;/STRONG&gt; and &lt;STRONG&gt;subType&lt;/STRONG&gt; columnnames in measures/calculations&lt;/P&gt;&lt;P&gt;My DAX measures (&lt;STRONG&gt;NB!&lt;/STRONG&gt; without IF statements these measures makes cartesian product for subType (&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/DAX-Unwanted-cartesian-product-lines/m-p/3013796/highlight/true#M102263" target="_self"&gt;details&lt;/A&gt;)):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;lastDate2 = 
IF(        
    NOT ISEMPTY(tstTable),
    CALCULATE(
        LASTDATE(tstTable[Date]),
        REMOVEFILTERS(tstTable[Date])
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;rnkDate2 = 
VAR t =
    CALCULATETABLE(
        VALUES(tstTable[Date]),
        REMOVEFILTERS(tstTable[Date])
    )
RETURN 
    IF( 
        NOT ISEMPTY(tstTable),        
        RANKX(
            t,
            LASTDATE(tstTable[Date])
        )    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it explicitly uses &lt;STRONG&gt;CALCULATE&lt;/STRONG&gt; and &lt;STRONG&gt;CALCULATETABLE&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;QUESTION&lt;/STRONG&gt;: how to get the same functionality without explicit use of these functions?&lt;/P&gt;&lt;P&gt;Data Model:&lt;BR /&gt;&lt;img /&gt;Source file &lt;A href="https://github.com/DenisSipchenko/Power-BI/blob/main/Questions/DAX_UnwantedRows.pbix" target="_self"&gt;Download&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 09:52:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3028126#M103341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T09:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: NO CALCULATE theory test1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3030075#M103516</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Not sure if you can avoid explicitly referencing Type and Subtype in that case. It's an unforunate aspect of CALCULATE mania that Microsoft has created certain functions like REMOVEFILTERS that only work as a filter clause within the CALCULATE function versus just a general filter function like ALL and ALLEXCEPT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;div data-video-id="https://youtu.be/fH0VcV9Smow?t=465" data-video-remote-vid="https://youtu.be/fH0VcV9Smow?t=465" 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%2FfH0VcV9Smow%3Fstart%3D465%26feature%3Doembed%26start%3D465&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfH0VcV9Smow&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FfH0VcV9Smow%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 02:15:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3030075#M103516</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-01-19T02:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: NO CALCULATE theory test1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3030787#M103564</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;&amp;nbsp;&lt;BR /&gt;Please don't give up! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;CALCULATE is not only your own headache...&lt;/P&gt;&lt;P&gt;Probably, It would be too ideal to exclude CALCULATE usage everywhere.&lt;BR /&gt;But, If it's not possible, it would be nice to have a list of&amp;nbsp; "NO CALCULATE" limitations.&lt;/P&gt;&lt;P&gt;Screens from&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;ALLEXCEPT without CALCULATE video:&lt;BR /&gt;&lt;STRONG&gt;Before:&lt;BR /&gt;&lt;/STRONG&gt;&lt;img /&gt;&lt;BR /&gt;&lt;STRONG&gt;After&lt;/STRONG&gt;:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For me this topic looks corelated with SQLBI experts materials about &lt;A href="https://www.sqlbi.com/?s=variables&amp;amp;type=" target="_self"&gt;Variables in DAX&lt;/A&gt;.&lt;BR /&gt;Basicaly, you are talking the same things by different words: how to write code that works like estimated.&lt;BR /&gt;Just "NO CALCULATE" title is a bit more "flashy".&lt;/P&gt;&lt;P&gt;Last example by &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;&amp;nbsp;&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=iKPaTW_ESrI&amp;amp;list=RDCMUCcc21gBGNJwZM_eDEByeN-Q&amp;amp;index=1&amp;amp;ab_channel=SQLBI" target="_self"&gt;Debugging DAX measures in Power BI&lt;/A&gt; (first 12 minutes):&lt;BR /&gt;&lt;STRONG&gt;Before&lt;/STRONG&gt;: Beautiful&amp;amp;Compact, but not working as estimated:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;After&lt;/STRONG&gt;: Verbose, but understandable&amp;amp;debuggable and working as estimated:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&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;</description>
      <pubDate>Thu, 19 Jan 2023 09:41:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3030787#M103564</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T09:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: NO CALCULATE theory test1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3031335#M103592</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Well, variable use is recommended whether using CALCULATE or not using CALCULATE. The difference in the No CALCULATE approach is that it generally eschews the use of CALCULATE for more "readable" and less "complex" DAX. CALCULATE is a super complex function that can easily give really kind of bizarre and wacky results, particularly in single table data models. It is very "black box" meaning you can't debug internally what exactly it is doing. But, the reality is that CALCULATE is really just a filter function. Essentially you can state what CALCULATE does with the words:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Go perform this calculation but modify the filter context with these filter clauses I am specifying"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, how it goes about that is black box and complex. So, instead, the idea of the No CALCULATE approach is simple:&lt;/P&gt;
&lt;P&gt;1. Start with a table&lt;/P&gt;
&lt;P&gt;2. Filter and/or group the table as appropriate&lt;/P&gt;
&lt;P&gt;3. Use an X aggregator to aggregate across your filtered/grouped table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using this simple, 3 step approach, most DAX problems can be solved quite easily and by doing this process using variables it is super easy to debug and understand every step of what is going on. And CALCULATE is not necessary (because it's really just a filtering function after all and you can do most of that using FILTER).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are complex scenarios where you have to use CALCULATE but this is more because Microsoft has designed filter functions that only work with CALCULATE rather than the No CALCULATE process itself. So, there will always be scenarios where you *have* to use CALCULATE but they are minimal and would likely be completely eliminated if Microsoft actually made functions like REMOVEFILTERS and other similar functions work outside of CALCULATE or provide equivalent functions.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 13:51:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NO-CALCULATE-theory-test1/m-p/3031335#M103592</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-01-19T13:51:27Z</dc:date>
    </item>
  </channel>
</rss>

