<?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: Dynamically Using SUM X for allselected values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948687#M42430</link>
    <description>&lt;LI-CODE lang="csharp"&gt;[Sum of Avg Sales Over Column] =
SUMX(
    DISTINCT( Dimension[Column] ), // use VALUES if you've got RI problems
    CALCULATE(
        AVERAGE( FactTable[Sales Amount] )
    )
)

// HASONEVALUE is redundant in 
// your code since if there's only
// one T[Column] value visible
// in the current context, SUMX
// will sum up over just one value.&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 09 Jul 2021 16:54:42 GMT</pubDate>
    <dc:creator>daxer-almighty</dc:creator>
    <dc:date>2021-07-09T16:54:42Z</dc:date>
    <item>
      <title>Dynamically Using SUM X for allselected values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948621#M42424</link>
      <description>&lt;P&gt;Hi guys I have a simple measure called &lt;STRONG&gt;Average Sales = AVERAGEX(VALUES(FISCAL YEAR),TOTAL SALES))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Which is essentially calculating the average of total sales across all present years.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula works as expected, but I find that my totals are being calculated as the average and not the sum of any column values I select.&amp;nbsp; &amp;nbsp;So I have been using Sumx(values("any column field"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, I am using around 3 column fields as my values with this sumx calculation to get the sum of all average sales of all the selected values and I am having to create a sumx calculation for each.&amp;nbsp; Is there a way to create only 1 sumx calculation witht he ability to sum x all selected values??&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:23:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948621#M42424</guid>
      <dc:creator>cdawidow</dc:creator>
      <dc:date>2021-07-09T16:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using SUM X for allselected values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948635#M42426</link>
      <description>&lt;P&gt;Most likely your formula like&amp;nbsp;&lt;SPAN&gt;SUM( VALUES( "any column field" ) ) is incorrect. VALUES removes duplicates which means that if you have 2 records in a table that have the same value in the field, the value will only be counted once in SUM. Don't think this is what you'd want.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The rest of the post is not within my grasp.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948635#M42426</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-09T16:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using SUM X for allselected values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948669#M42428</link>
      <description>&lt;P&gt;Thanks for the response.&amp;nbsp; Yes, I understand that values removes duplicates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But lets say I have 2 columns each with unique values ( Customers and Products) along with my average sales measure stated above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to build&amp;nbsp; a sumx calculation that follows the following rules:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If(Hasonevalue( column name),average sales, sumx(column name),average sales)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:48:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948669#M42428</guid>
      <dc:creator>cdawidow</dc:creator>
      <dc:date>2021-07-09T16:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using SUM X for allselected values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948687#M42430</link>
      <description>&lt;LI-CODE lang="csharp"&gt;[Sum of Avg Sales Over Column] =
SUMX(
    DISTINCT( Dimension[Column] ), // use VALUES if you've got RI problems
    CALCULATE(
        AVERAGE( FactTable[Sales Amount] )
    )
)

// HASONEVALUE is redundant in 
// your code since if there's only
// one T[Column] value visible
// in the current context, SUMX
// will sum up over just one value.&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:54:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Using-SUM-X-for-allselected-values/m-p/1948687#M42430</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-09T16:54:42Z</dc:date>
    </item>
  </channel>
</rss>

