<?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 SUMX and CONCATENATEX give different results! in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4332851#M172016</link>
    <description>&lt;P&gt;So, it took me hours to find this issue and I still cannot believe my eyes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same calculation within the same measure with the same contexts, gives different results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the measure I use for debugging. You see everything is the same, only SUMX and CONCATEATEX differ.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;WeightedScore =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CONCATENATEX&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;dimContacts&lt;/SPAN&gt;&lt;SPAN&gt;[CID]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Weight]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;[Score per row]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;" -- "&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;dimContacts&lt;/SPAN&gt;&lt;SPAN&gt;[cid]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Weight]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;[Score per row]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN&gt;And this is the result I get, check the last column with the measure's output:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 10:37:37 GMT</pubDate>
    <dc:creator>nyarlathotep</dc:creator>
    <dc:date>2024-12-17T10:37:37Z</dc:date>
    <item>
      <title>SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4332851#M172016</link>
      <description>&lt;P&gt;So, it took me hours to find this issue and I still cannot believe my eyes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same calculation within the same measure with the same contexts, gives different results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the measure I use for debugging. You see everything is the same, only SUMX and CONCATEATEX differ.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;WeightedScore =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CONCATENATEX&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;dimContacts&lt;/SPAN&gt;&lt;SPAN&gt;[CID]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Weight]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;[Score per row]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;" -- "&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;dimContacts&lt;/SPAN&gt;&lt;SPAN&gt;[cid]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Weight]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;[Score per row]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN&gt;And this is the result I get, check the last column with the measure's output:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 10:37:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4332851#M172016</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-17T10:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4333100#M172032</link>
      <description>&lt;P&gt;Please provide more details. Are Weight and Score per row columns or measures?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;Do not include sensitive information. Do not include anything that is unrelated to the issue or question. &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Need help uploading data? &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 13:04:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4333100#M172032</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-17T13:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4333918#M172067</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="513260" data-lia-user-login="nyarlathotep" class="lia-mention lia-mention-user"&gt;nyarlathotep&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the reason for the different results is that CONCATENATEX and SUMX have different functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CONCATENATEX: This function concatenates the results of evaluating the expression in each row of the table. It returns a text string that combines all the results.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;SUMX: This function evaluates the expression in each row of the table and then sums the results.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;In your measure, CONCATENATEX converts the results of [Weight] * [Score per row] to text and concatenates them, while SUMX sums those results to numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a result, CONCATENATEX converts numeric results to text, sometimes leading to unexpected formatting or rounding problems. Also, each function may run in a slightly different context, especially if implicit conversions or contextual conversions occur.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 01:26:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4333918#M172067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-18T01:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4334358#M172089</link>
      <description>&lt;P&gt;Sorry, i was a bit oveworked yesterday after so&amp;nbsp; much effort to debug this. Here is a&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1J5hFXAD_h-iC7fmd5rnq7VOM-PmDuggQ/view?usp=sharing" target="_blank" rel="noopener"&gt;.pbix reproducing the error&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;(can't attach files here).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I need to calculate the scores of CIDs weighted by net sales. I am using SUMX() because I need to insert this into a larger concept where there are groups of CIDs and I get the group's score (each CID contained in the group is weighted by net sales).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The obvious way to do this, a way that worked fine until recently is to iterate over CIDs, and sum each weighted score as in the measure "sumx". But this stopped working at some point! I guess some update messed with the functionality.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used CONCATENATEX() while debugging the issue and was surprised to see that the "concatx" measure returned the expected results, ans "sumx" failed.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Then I put both sumx &amp;amp; concatx in the same measure, to ensure that they were being calculated under the exact same contexts.&lt;BR /&gt;&lt;BR /&gt;You can see the rest in the screenshot...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 06:48:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4334358#M172089</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-18T06:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4334360#M172090</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; thank you for replying, please check my additional info given to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am well aware of how SUMX and CONCATENATEX work, I used concat for debugging. Issue is that SUMX does not return the expected results -- also, running under the same contexts, I expected both concatx and sumx to return the same.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 06:37:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4334360#M172090</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-18T06:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4335637#M172153</link>
      <description>&lt;P&gt;You are looking at the difference between sums of averages and averages of sums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;None of your initial activities (Score, Weight) require measures since your CIDs are unique.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 20:18:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4335637#M172153</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-18T20:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336305#M172182</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;thanks for checking this out -- but I think I cannot get my point across effectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's forget about my business logic and needs here, and just focus on the DAX used and the results returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I am using SUMX to sum the product of two values: [weight] * [score per row]. What i expect to see for each row in the table visual is just the product of the row's weight*score itself, since there is only one row to sum. In the totals row, it should sum the products of each row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since every row has the correct values shown for score &amp;amp; weight, why would their product in SUMX be wrong? Just consider these columns for example:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Here, all the rows show wrong products except for the total. So what is causing the product in the rows to be different for sumx vs. concatx? You can check the model in my othjer reply, here is the measure used for column "sumx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sumx = 
SUMX( 
    VALUES( Data[cid]),
    [Weight] * [Score per row]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks again for looking into this. It is driving me crazy, i cannot explain this.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:57:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336305#M172182</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-19T12:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336905#M172203</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="513260" data-lia-user-login="nyarlathotep" class="lia-mention lia-mention-user"&gt;nyarlathotep&lt;/a&gt;&amp;nbsp;- Firstly, the fix is in your Weight measure - it's your use of ALLSELECTED( ) inside the calculate. Because you are just trying to calculate a total value, you dont need the CALCULATE at all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR __allNetSales =
    SUMX ( ALL ( Data[CID] ), [Net Sales] * ( [Score per row] &amp;lt;&amp;gt; 0 ) )
VAR __result =
    DIVIDE ( [Net Sales], __allNetSales )
RETURN
    __result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not going to try to explain exactly what's happening when there are two Italian folk that can do it way more eloquently -&amp;nbsp;&lt;A href="https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/" target="_blank"&gt;https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/&lt;/A&gt;&amp;nbsp;- scroll to the ALLSELECTED with no parameters section towards the bottom!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:17:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336905#M172203</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-12-19T12:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336975#M172205</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;thanks for your reply, actually this measure is part of a larger calculation that goes over not ALL CIDs, but only those selected by the user -- CIDs are like customers, and they belong to groups, so report users might select only some of the groups, thus a subset of CIDs, not ALL.&lt;BR /&gt;&lt;BR /&gt;But the actual riddle for me is not the business logic, forget that -- it is why CONCATX and SUMX behave differently, in exactly the same frame.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:56:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4336975#M172205</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-19T12:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4337244#M172212</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="513260" data-lia-user-login="nyarlathotep" class="lia-mention lia-mention-user"&gt;nyarlathotep&lt;/a&gt;&amp;nbsp;- in that case, just move the Weight calculation inside the final measure and you can use ALLSELECTED()&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR __allNetSales =
    CALCULATE ( [Net Sales] * ( [Score per row] &amp;lt;&amp;gt; 0 ), ALLSELECTED ( Data[CID] ) )
VAR __weight =
    DIVIDE ( [Net Sales], __allNetSales )
RETURN
    SUMX ( VALUES ( Data[cid] ), __weight * [Score per row] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the riddle, I can only assume it's the way a string based Contcatenatex is dealing with context transition and the filter contexts.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 15:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4337244#M172212</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-12-19T15:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4337744#M172239</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I think this case is related to a context transition due to the new CALCULATE that results from the call of the [Weight] measure within the SUMX.&lt;BR /&gt;To avoid this problem, I suggest not calling the measure inside the iterator:&lt;BR /&gt;Sumx2 =&lt;BR /&gt;VAR __allNetSales = CALCULATE(&lt;BR /&gt;SUMX( VALUES( Data[CID] ), [Net Sales] * ([Score per row]&amp;lt;&amp;gt;0 )),&lt;BR /&gt;ALL SELECTED()&lt;BR /&gt;)&lt;BR /&gt;VAR __result = DIVIDE( [Net Sales], __allNetSales)&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES(Data[cid]),&lt;BR /&gt;__result &amp;nbsp;* [Score per row]&lt;BR /&gt;)&lt;BR /&gt;I hope this solution ends your headache &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 01:17:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4337744#M172239</guid>
      <dc:creator>pcoley</dc:creator>
      <dc:date>2024-12-20T01:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340729#M172365</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="513260" data-lia-user-login="nyarlathotep" class="lia-mention lia-mention-user"&gt;nyarlathotep&lt;/a&gt;&amp;nbsp;- did we resolve your issue? If we did, please select the appropriate solution, it helps with visibility for others and for SuperUsers to keep their status! Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 10:53:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340729#M172365</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-12-23T10:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340875#M172377</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;unfortunately no -- and to be clear, the issue was: why CONCATENATEX and SUMX are using different values for calculations under the same contexts.&lt;BR /&gt;&lt;BR /&gt;The issue is also mentioned here, 2+ years ago:&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Arbitrary-Shaped-Sets/m-p/2272097/highlight/true#M55359" target="_blank"&gt;https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Arbitrary-Shaped-Sets/m-p/2272097/highlight/true#M55359&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still no definite/official answer on this.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 14:05:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340875#M172377</guid>
      <dc:creator>nyarlathotep</dc:creator>
      <dc:date>2024-12-23T14:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340994#M172382</link>
      <description>&lt;P&gt;As Marco had suggested in the other post this is likely due to different optimizations/query plans.&amp;nbsp; Maybe&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="503" data-lia-user-login="jeffrey_wang" class="lia-mention lia-mention-user"&gt;jeffrey_wang&lt;/a&gt;&amp;nbsp;has an opinion on that.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 17:15:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4340994#M172382</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-23T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX and CONCATENATEX give different results!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4341178#M172396</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="513260" data-lia-user-login="nyarlathotep" class="lia-mention lia-mention-user"&gt;nyarlathotep&lt;/a&gt;&amp;nbsp;even thoug both measures initiates with the same context (because of the filter context applied at the report)&amp;nbsp;there are context transitions that you don't seem to be taking into account. Please check the answers above, there are clear explanations of the logic created by powerbi to run your codes (it's not a bug, the code runs exactly as it should):&lt;BR /&gt;&lt;SPAN&gt;Any measure reference implies&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://dax.guide/calculate/?aff=sqlbi" target="_blank" rel="noopener"&gt;CALCULATE&lt;/A&gt;&lt;SPAN&gt;, which invokes the &lt;STRONG&gt;context transition&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;In this case the measure with the sumx formula refers to 2 measures, and there will be a CALCULATE in each of them and due to the CALCULATE there will be the context transition within the iterator (SUMX). The "Weight" measure actually has its own CALCULATE; and the full code for the extended reference measure inside the SUMX will also be affected by the new CALCULATE and the outer filter context made by this new CALCULATE. That context transition is the reason why you have two different results.&amp;nbsp;This is how power bi works.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 22:40:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-CONCATENATEX-give-different-results/m-p/4341178#M172396</guid>
      <dc:creator>pcoley</dc:creator>
      <dc:date>2024-12-23T22:40:14Z</dc:date>
    </item>
  </channel>
</rss>

