<?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: What's the difference between these 2 queries? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576232#M137880</link>
    <description>&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;Now I know what I misunderstood about the CALCULATE.&lt;/P&gt;&lt;P&gt;I &lt;SPAN&gt;mistakenly thought&lt;/SPAN&gt; CALCULATE merges the filter arguments by intersection before applying to the data model as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The arguments are evaluated &lt;SPAN&gt;independently from each other in the CALCULATE, and they filter the corresponding columns&amp;nbsp;separately before final evaluation.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Dec 2023 15:02:59 GMT</pubDate>
    <dc:creator>RandVac</dc:creator>
    <dc:date>2023-12-10T15:02:59Z</dc:date>
    <item>
      <title>What's the difference between these 2 queries?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576045#M137867</link>
      <description>&lt;P&gt;A small data model with two tables &amp;lt;Dfact&amp;gt; &amp;lt;Ddim&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;Ddim&amp;gt;[&lt;EM&gt;SubCategory&lt;/EM&gt;] (1) --- (*) &amp;lt;Dfact&amp;gt;[&lt;EM&gt;SubCategory&lt;/EM&gt;]&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first query returns 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;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lt;/TD&gt;&lt;TD&gt;SC4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C3&lt;/TD&gt;&lt;TD&gt;SC5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;LI-CODE lang="javascript"&gt;EVALUATE
CALCULATETABLE ( 
	{ COUNTROWS ( Ddim ) }, 
	Dfact, 
	Dfact[SubCategory] = "SC1" 
)

EVALUATE
SUMMARIZECOLUMNS (
    Dfact,
    FILTER ( ALL ( Dfact[SubCategory] ), Dfact[SubCategory] = "SC1" ),
    "count", COUNTROWS ( Ddim )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the difference between the 2 quries?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 06:20:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576045#M137867</guid>
      <dc:creator>RandVac</dc:creator>
      <dc:date>2023-12-10T06:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: What's the difference between these 2 queries?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576074#M137869</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure what is your desired outcome, but regarding the first one,&lt;/P&gt;
&lt;P&gt;it shows the same result if it is written like below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, having the condition like the below on many side of the relationship&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;Dfact[SubCategory] = "SC1"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;does not influence on counting rows in one side of the relationship.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you want to see this result = 1, and please try something like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/relatedtable-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank" rel="noopener"&gt;RELATEDTABLE function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 08:18:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576074#M137869</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-12-10T08:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: What's the difference between these 2 queries?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576161#M137876</link>
      <description>&lt;P&gt;This is what happens under the hood for query 1,&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For any CALCULATE() / CALCULATETABLE(), DAX engine evaluates all filter arguments ( 1.expanded table and 2.predicate in your case ) independently from each other before final evaluation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More specifically,&lt;/P&gt;
&lt;P&gt;1.expanded table&lt;/P&gt;
&lt;P&gt;filters Ddim via [related C] and [related SC] (data lineage kept)&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2.predicate&lt;/P&gt;
&lt;P&gt;doesn't propagate the filtering to Ddim due to 1:* direction constraint by default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An alternative to query 2 is&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 12:49:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576161#M137876</guid>
      <dc:creator>ThxAlot</dc:creator>
      <dc:date>2023-12-10T12:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: What's the difference between these 2 queries?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576232#M137880</link>
      <description>&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;Now I know what I misunderstood about the CALCULATE.&lt;/P&gt;&lt;P&gt;I &lt;SPAN&gt;mistakenly thought&lt;/SPAN&gt; CALCULATE merges the filter arguments by intersection before applying to the data model as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The arguments are evaluated &lt;SPAN&gt;independently from each other in the CALCULATE, and they filter the corresponding columns&amp;nbsp;separately before final evaluation.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 15:02:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576232#M137880</guid>
      <dc:creator>RandVac</dc:creator>
      <dc:date>2023-12-10T15:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: What's the difference between these 2 queries?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576233#M137881</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I was wondering how CALCULATE merges the filter arguments and yes I was confused why it's not 1.&lt;/P&gt;&lt;P&gt;I mistakenly thought CALCULATE would apply the filter Dfact[SubCategory] = "SC1" to the first filter argument &amp;lt;Dfact&amp;gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 15:09:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/What-s-the-difference-between-these-2-queries/m-p/3576233#M137881</guid>
      <dc:creator>RandVac</dc:creator>
      <dc:date>2023-12-10T15:09:33Z</dc:date>
    </item>
  </channel>
</rss>

