<?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: SUMX over dimension table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566072#M31154</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;Two things to get the same result in both measures:&lt;/P&gt;&lt;P&gt;1. A change at the end of your measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxfromacctytype :=
SUMX (
    'Account Type',
    IF (
        'Account Type'[Account Type] = "PL",
        CALCULATE ( SUM ( TB[amount] ) ),
        CALCULATE (
            SUM ( TB[amount] ) * -.3,
            REMOVEFILTERS ( Glmapping ),
            VALUES ( Glmapping[Company Code] )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;2. In your visual slice by the dimensions at the one side of the relationship with your GLmapping table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 23:06:46 GMT</pubDate>
    <dc:creator>Payeras_BI</dc:creator>
    <dc:date>2020-12-22T23:06:46Z</dc:date>
    <item>
      <title>SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564142#M31093</link>
      <description>&lt;P&gt;Hello, im trying to optimize my sumx measure. my goal is to use a table that has fewer rows to make my iteration measure efficient. In my example, i have a trial balance which is my fact table containing the gl code, company code and amount. above it is gl mapping table which contains the gl code, gl name, company code and acct type. finally&amp;nbsp; above the gl mapping table, i created two dimension tables , company code and acct type.&lt;/P&gt;&lt;P&gt;to illustrate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;company code table : accty type table&lt;/P&gt;&lt;P&gt;gl mapping&lt;/P&gt;&lt;P&gt;trial balance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a simple sumx measure like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX(
	Glmapping,
	IF(
		Glmapping[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALLEXCEPT(Glmapping,Glmapping[Company Code]))))&lt;/LI-CODE&gt;&lt;P&gt;the above measure works fine, but i wanted to change the table to refer to the a cross join of the two above dimension table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX(
	CROSSJOIN(VALUES('Account Type'[Account Type]),VALUES(Company[Company code])),
	IF(
		'Account Type'[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALLEXCEPT(Glmapping,Glmapping[Company Code]))))&lt;/LI-CODE&gt;&lt;P&gt;i having a weird result. appreciate if you can explain me why. I do have sample power pivot file, dont know how to attach it in this message to better illustrate my question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 05:34:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564142#M31093</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-22T05:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564177#M31095</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , need of cross join?&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 05:51:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564177#M31095</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-12-22T05:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564279#M31096</link>
      <description>&lt;P&gt;i do have a sample file how do i attach in this message? i use cross join, since the i use two different dimension table as my iteration, acct type and company code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 06:47:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564279#M31096</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-22T06:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564325#M31097</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 07:07:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564325#M31097</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-22T07:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564625#M31100</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;By using Crossjoin you are iterating "a &lt;SPAN&gt;table that contains the Cartesian product of all rows from all tables in the arguments".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Accounting type = PL / Company Code A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Accounting type = PL / Company Code B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Accounting type = PL / Company Code C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Accounting type = PL / Company Code D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably not what you want to iterate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 08:55:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564625#M31100</guid>
      <dc:creator>Payeras_BI</dc:creator>
      <dc:date>2020-12-22T08:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564867#M31105</link>
      <description>&lt;P&gt;Re:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"I do have a sample file how do i attach in this message?"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can use a onedrive, google drive or similar link to upload your files.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 10:03:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564867#M31105</guid>
      <dc:creator>Payeras_BI</dc:creator>
      <dc:date>2020-12-22T10:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564930#M31110</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="267852" data-lia-user-login="Payeras_BI" class="lia-mention lia-mention-user"&gt;Payeras_BI&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp; just to complete the picture:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the source data:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the diagram:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created two sumx measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from gl mapping table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxfromglmapping:=SUMX(
	Glmapping,
	IF(
		Glmapping[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALLEXCEPT(Glmapping,Glmapping[Company Code]))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from acct type table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxfromglmapping:=SUMX(
	Glmapping,
	IF(
		Glmapping[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALLEXCEPT(Glmapping,Glmapping[Company Code]))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the result in pivot:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so my question is why is their difference in the result if i change the iterating table?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 10:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564930#M31110</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-22T10:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564936#M31111</link>
      <description>&lt;P&gt;correct here is my sumx measure using acct type table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxfromacctytype:=SUMX(
	'Account Type',
	IF(
		'Account Type'[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALLEXCEPT(Glmapping,Glmapping[Company Code]))))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 10:37:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1564936#M31111</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-22T10:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566072#M31154</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two things to get the same result in both measures:&lt;/P&gt;&lt;P&gt;1. A change at the end of your measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxfromacctytype :=
SUMX (
    'Account Type',
    IF (
        'Account Type'[Account Type] = "PL",
        CALCULATE ( SUM ( TB[amount] ) ),
        CALCULATE (
            SUM ( TB[amount] ) * -.3,
            REMOVEFILTERS ( Glmapping ),
            VALUES ( Glmapping[Company Code] )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;2. In your visual slice by the dimensions at the one side of the relationship with your GLmapping table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 23:06:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566072#M31154</guid>
      <dc:creator>Payeras_BI</dc:creator>
      <dc:date>2020-12-22T23:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566280#M31159</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="267852" data-lia-user-login="Payeras_BI" class="lia-mention lia-mention-user"&gt;Payeras_BI&lt;/a&gt;&amp;nbsp;thank you for the feedback, it worked using powerbi :). However, since im using power pivot, i think removefilters is not available. what i did is use all instead of removefilters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TestSumxacctytype:=SUMX(
	'Account Type',
	IF(
		'Account Type'[Account Type]="PL",
		CALCULATE(SUM(TB[amount])),
		CALCULATE(SUM(TB[amount])*-.3, ALL(Glmapping), VALUES(Glmapping[Company Code]))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked also. Given this, my questions are:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What is the difference between ALL and REMOVEFILTERS?&lt;/LI&gt;&lt;LI&gt;If both cases, we remove the filter, then add another filter for the company code,so what is the difference between this approach and using ALLexcept(GLMapping, GLMapping[Company Code])?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 23 Dec 2020 03:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566280#M31159</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-23T03:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX over dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566736#M31164</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Yes,&amp;nbsp;REMOVEFILTERS is just an alias for ALL when used as a CALCULATE modifer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Here you need to remove filters from GLMapping and restoring it for againg for&amp;nbsp;&lt;SPAN&gt;GLMapping[Company Code]&lt;/SPAN&gt; &lt;U&gt;taking into account the previous cross-filtering&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/" target="_blank"&gt;https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 08:37:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-over-dimension-table/m-p/1566736#M31164</guid>
      <dc:creator>Payeras_BI</dc:creator>
      <dc:date>2020-12-23T08:37:10Z</dc:date>
    </item>
  </channel>
</rss>

