<?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: sum by mainItem in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265276#M120857</link>
    <description>&lt;P&gt;Glad to hear it's working (using ALL rather than REMOVEFILTERS).&lt;/P&gt;
&lt;P&gt;These functions are indeed equivalent when used in this way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If REMOVEFILTERS is unavailable, I'm guessing you are connecting to an older version of Analysis Services Tabular.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference, the compatibility for DAX functions can be found on dax.guide:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://dax.guide/removefilters/" target="_blank" rel="noopener"&gt;https://dax.guide/removefilters/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jun 2023 08:38:06 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2023-06-02T08:38:06Z</dc:date>
    <item>
      <title>sum by mainItem</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265125#M120851</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I thought would be an easy tasked proved more complex then I thought&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table A&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;itemSK&lt;/TD&gt;&lt;TD&gt;count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&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Count by mainitem&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;d&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me write dax for "Count by mainitem" please &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;&lt;P&gt;I could give you all my filed attempts but i don't think it will help(?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 06:48:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265125#M120851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-02T06:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: sum by mainItem</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265162#M120853</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the attached PBIX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, you should ensure the model is set up like this (which I imagine it already is):&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then create this measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count by mainitem = 
CALCULATE (
    SUM ( 'Table A'[count] ),
    REMOVEFILTERS ( 'Item' ),
    VALUES ( 'Item'[Mainitemid] )
)&lt;/LI-CODE&gt;
&lt;P&gt;This measure sums 'Table A'[count] for the values of 'Item'[Mainitemid] corresponding to the visible rows of 'Item', but removing any other filters on the 'Item' table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 07:14:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265162#M120853</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-06-02T07:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: sum by mainItem</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265184#M120855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply.&amp;nbsp;&lt;BR /&gt;I am getting an error on REMOVEFILTERS,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;"Cannot find name 'REMOVEFILTERS'&lt;BR /&gt;'REMOVEFILTERS' is not a function."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using direct query to access data and there is a connection between the tabels like you describe (My model is more complex then this but I scaled down to only highlight the importnat parts.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I replaced REMOVEFILTER with ALL and from what i can se this is giving me the deciered result.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 07:31:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265184#M120855</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-02T07:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: sum by mainItem</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265276#M120857</link>
      <description>&lt;P&gt;Glad to hear it's working (using ALL rather than REMOVEFILTERS).&lt;/P&gt;
&lt;P&gt;These functions are indeed equivalent when used in this way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If REMOVEFILTERS is unavailable, I'm guessing you are connecting to an older version of Analysis Services Tabular.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference, the compatibility for DAX functions can be found on dax.guide:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://dax.guide/removefilters/" target="_blank" rel="noopener"&gt;https://dax.guide/removefilters/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 08:38:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sum-by-mainItem/m-p/3265276#M120857</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-06-02T08:38:06Z</dc:date>
    </item>
  </channel>
</rss>

