<?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 is going wrong with my AllExcept()? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114793#M163323</link>
    <description>&lt;P&gt;So it seems I got it all wrog. Thanks for clarifying. So, just to get the concept right, shou;ld my code be:&lt;/P&gt;&lt;P&gt;salesBycity =&lt;/P&gt;&lt;P&gt;calculate(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[sales],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;allexcept(salesByStore, salesbystore[store_id]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;on the many side?&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2024 03:32:42 GMT</pubDate>
    <dc:creator>arunbyc</dc:creator>
    <dc:date>2024-08-23T03:32:42Z</dc:date>
    <item>
      <title>what is going wrong with my AllExcept()?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114028#M163281</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;what is going wrong with my code using AllExcept()&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;a minute ago&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I have three tables with the following columns in my data model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Store lookup [store_id]&lt;/P&gt;&lt;P&gt;Product_lookup [Product_Id]&lt;/P&gt;&lt;P&gt;and the fact table:&lt;/P&gt;&lt;P&gt;Sales by store:&amp;nbsp; [Product], [Store_id], [quantity] and [unit_price]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two measures with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;sumx&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'&lt;/SPAN&gt;&lt;SPAN&gt;[quantity_sold]&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'&lt;/SPAN&gt;&lt;SPAN&gt;[unit_price]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sales_by_City =&lt;/SPAN&gt; &lt;SPAN&gt;calculate&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;allexcept&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Store Lookup'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Store Lookup'&lt;/SPAN&gt;&lt;SPAN&gt;[store_city]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(The purpose of the code is to understand AllExcept,. and *not* to simply get sales by store)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My visual has two slicers, one for product and the other for Store Id, in addition to sales by Product and store.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I thought this code would do the following:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1) It would always ignore the slicer for the Product&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2) Similar to the way fALL() would ignore all of the filter contexts and show Total Sales against all products/All stores, I expected AllExcept(New York) would show the combined Total of NY sales against all products for store location of NY, and similarly combined total of all Long Island City sales when the store location is Long Island.City&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Not only is my visual not ignoring the Product filter context, but it is showing the NY sales for *each product* separately and not the combined total for all products in NY. (or Long Island, depending on the store location)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Is my understanding of how AllExcpt() should work wrong or is my code wrong?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Aug 2024 18:01:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114028#M163281</guid>
      <dc:creator>arunbyc</dc:creator>
      <dc:date>2024-08-22T18:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: what is going wrong with my AllExcept()?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114482#M163313</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="770318" data-lia-user-login="arunbyc" class="lia-mention lia-mention-user"&gt;arunbyc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When ALLEXCEPT is used as a modifier within CALCULATE, it removes filters on all columns of the expanded table provided in the first argument, except for columns/tables listed in the 2nd argument onwards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no way to use ALLEXCEPT to remove filters from columns of &lt;EM&gt;all&lt;/EM&gt; tables except for specified columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the modifier&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ALLEXCEPT ( 'Store Lookup', 'Store Lookup'[store_city] )&lt;/LI-CODE&gt;
&lt;OL&gt;
&lt;LI&gt;Removes filters that may exist on all columns of the expanded&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;'Store Lookup'&lt;/STRONG&gt; table (which I assume is just &lt;STRONG&gt;'Store Lookup'&lt;/STRONG&gt;&amp;nbsp;itself if it is a typical dimension and is not on the many-side of any many:one relationships) except retains filters on&amp;nbsp;&lt;STRONG&gt;'Store Lookup'[store_city]&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;Has no effect on filters on columns of any other table, including&amp;nbsp;&lt;STRONG&gt;'product'&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;For that reason, the results you are getting appear consistent with how ALLEXCEPT should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some examples of alternative measures that I think would give results close to what you were expecting:&lt;/P&gt;
&lt;P&gt;A measure that would ignore filters from all tables but retain any filters on &lt;STRONG&gt;'Store Lookup'[store_city]&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;would be:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sales_by_City =
CALCULATE (
    [Sales],
    REMOVEFILTERS (), -- or ALL ()
    FILTERS ( 'Store Lookup'[store_city] ) -- retain filters on this specific column
)&lt;/LI-CODE&gt;
&lt;P&gt;A variation that would do the same but retain visible values of&amp;nbsp;&lt;STRONG&gt;'Store Lookup'[store_city]&lt;/STRONG&gt; would be:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sales_by_City =
CALCULATE (
    [Sales],
    REMOVEFILTERS (), -- or ALL ()
    VALUES ( 'Store Lookup'[store_city] ) -- retain visible values of this specific column
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully that helps explain the behaviour you're seeing. Please post back if needed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 01:30:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114482#M163313</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-08-23T01:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: what is going wrong with my AllExcept()?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114793#M163323</link>
      <description>&lt;P&gt;So it seems I got it all wrog. Thanks for clarifying. So, just to get the concept right, shou;ld my code be:&lt;/P&gt;&lt;P&gt;salesBycity =&lt;/P&gt;&lt;P&gt;calculate(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[sales],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;allexcept(salesByStore, salesbystore[store_id]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;on the many side?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 03:32:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114793#M163323</guid>
      <dc:creator>arunbyc</dc:creator>
      <dc:date>2024-08-23T03:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: what is going wrong with my AllExcept()?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114844#M163324</link>
      <description>&lt;P&gt;Yes, you certainly could use salesByStore as the first argument (assuming that is your fact table), and then specify tables or columns for filters to retain in the second argument.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would have the effect of removing all filters on columns of salesByStore and related tables related (on the 1-side), except the tables/columns listed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the 2nd+ arguments, I would suggest using columns of the 'Store Lookup' table (or the entire 'Store Lookup table) in this case, rather than columns of salesByStore, assuming filters would generally be applied on 'Store Lookup'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. this to retain just filters on the store_id column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;salesBycity =
CALCULATE ( [sales], ALLEXCEPT ( salesByStore, 'Store Lookup'[store_id] ) )&lt;/LI-CODE&gt;
&lt;P&gt;or this to retain any filter from 'Store Lookup':&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;salesBycity =
CALCULATE ( [sales], ALLEXCEPT ( salesByStore, 'Store Lookup' ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 04:56:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/what-is-going-wrong-with-my-AllExcept/m-p/4114844#M163324</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-08-23T04:56:11Z</dc:date>
    </item>
  </channel>
</rss>

