<?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 help with DAX formula - filter propagation - simple usecase in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3790078#M148098</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am trying to understand filter propagation, therefore I create simple schema a data&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is write 2 measures (one for Male and for Female) that count number of M/F&amp;nbsp; per each city, I tried&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count_m =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"M"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count_f =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"F"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and got incorrect result (Rio de Janeiro should be 0 for both)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;so my 2 questions are&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1) what s correct DAX formula (without adjusting data model!)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2) why filter context is not propagated to fact table from both dimensions when there are paired values? ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;thanks for help&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 25 Mar 2024 20:55:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-25T20:55:13Z</dc:date>
    <item>
      <title>help with DAX formula - filter propagation - simple usecase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3790078#M148098</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am trying to understand filter propagation, therefore I create simple schema a data&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is write 2 measures (one for Male and for Female) that count number of M/F&amp;nbsp; per each city, I tried&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count_m =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"M"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count_f =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Users&lt;/SPAN&gt;&lt;SPAN&gt;[Gender]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"F"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and got incorrect result (Rio de Janeiro should be 0 for both)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;so my 2 questions are&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1) what s correct DAX formula (without adjusting data model!)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2) why filter context is not propagated to fact table from both dimensions when there are paired values? ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;thanks for help&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Mar 2024 20:55:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3790078#M148098</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-25T20:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: help with DAX formula - filter propagation - simple usecase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3790166#M148102</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt; I would suggest this for &lt;STRONG&gt;count_m&lt;/STRONG&gt; (and similarly for &lt;STRONG&gt;count_f &lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;count_m =
CALCULATE (
    COUNTROWS ( Users ), -- COUNTROWS preferable to COUNT ( &amp;lt;column&amp;gt; )
    Users[Gender] = "M",
    SUMMARIZE ( Events, Users[ID_user] )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2)&lt;/STRONG&gt; With single-direction 1:many relationships as you have in this model (typically from a dimension to a fact table), filters on columns of the table 1-side (dimension) "propogate" to the table on the many-side. In other words, filters propogate following the direction of the relationship arrow.&lt;/P&gt;
&lt;P&gt;(Under the hood "expanded tables" are a more correct description happening - see article below)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Locations&lt;/STRONG&gt; filters &lt;STRONG&gt;Events&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Users&lt;/STRONG&gt; filters &lt;STRONG&gt;Events&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;But:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Events&lt;/STRONG&gt; does not filter &lt;STRONG&gt;Users&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Events&lt;/STRONG&gt; does not filter &lt;STRONG&gt;Locations&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Users&lt;/STRONG&gt; does not filter &lt;STRONG&gt;Locations&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;By adding SUMMARIZE(...) in the above suggested measure, the result is essentially that the visible rows of &lt;STRONG&gt;Events&lt;/STRONG&gt; are used to filter &lt;STRONG&gt;Users&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bidirectional relationships are also an option in some situations but I would not recommend that here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Suggested reading:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://mdxdax.blogspot.com/2011/03/logic-behind-magic-of-dax-cross-table.html" target="_blank" rel="noopener"&gt;https://mdxdax.blogspot.com/2011/03/logic-behind-magic-of-dax-cross-table.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://www.sqlbi.com/articles/expanded-tables-in-dax/" target="_blank" rel="noopener"&gt;https://www.sqlbi.com/articles/expanded-tables-in-dax/&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 23:23:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3790166#M148102</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-03-25T23:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: help with DAX formula - filter propagation - simple usecase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791060#M148130</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;thanks for explanation, just one last question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;is it possible to do it with RELATED function as well&amp;nbsp; (if yes, how ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )?&lt;/P&gt;&lt;P&gt;thanks for last reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 08:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791060#M148130</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-26T08:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: help with DAX formula - filter propagation - simple usecase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791285#M148137</link>
      <description>&lt;P&gt;Hiya&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wouldn't recommend RELATED or RELATEDTABLE here. They rely on a row context which means you need to introduce an iterator, and I can't see any advantage in doing that here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Purely for illustration, a possible measure that "works" using RELATEDTABLE but I wouldn't consider a good measure for this situation could be:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    SUMX ( Users, IF ( NOT ISEMPTY ( RELATEDTABLE ( Events ) ), 1 ) ),
    Users[Gender] = "M"
)&lt;/LI-CODE&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 10:32:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791285#M148137</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-03-26T10:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: help with DAX formula - filter propagation - simple usecase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791287#M148138</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;thanks for explanation !!!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 10:35:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-DAX-formula-filter-propagation-simple-usecase/m-p/3791287#M148138</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-26T10:35:07Z</dc:date>
    </item>
  </channel>
</rss>

