<?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: Weighted Averages in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/958180#M11085</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this might help you to solve your problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Weighted&amp;nbsp;=&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Keyword"&gt;SUM&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;'Table'[weight]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt; &lt;SPAN&gt;(COUNTROWS('Table') - COUNTROWS(FILTER('Table','Table'[weight]=0)))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 08:05:46 GMT</pubDate>
    <dc:creator>piyushszope</dc:creator>
    <dc:date>2020-03-04T08:05:46Z</dc:date>
    <item>
      <title>Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/951666#M10701</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I know the answer, which would be a pain, so I'm hoping there is an easier solution.&amp;nbsp; I am trying to find a weighted average for a column but some of the users don't populate one of the fields on a consistent basis or have that information.&amp;nbsp; Using the normal weighted average calcuations throws the true weighted average off because it is counting the balance which produces an incorrect weighted average calculation.&amp;nbsp; I know I can go in and edit the query, remove all the rows that are blank or 0 in that column, rename the query and then do it that way, however, I was looking to see if there was a DAX function that would ignore the row altogether if that field is blank or 0.&amp;nbsp; I value your thoughts on this.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:46:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/951666#M10701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-27T20:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/951898#M10715</link>
      <description>&lt;P&gt;Hello!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = AVERAGEA(Hoja2[weight])&lt;/LI-CODE&gt;&lt;P&gt;Doc:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dax/averagea-function-dax" target="_blank"&gt;https://docs.microsoft.com/en-us/dax/averagea-function-dax&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 01:34:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/951898#M10715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-28T01:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/957593#M11065</link>
      <description>&lt;P&gt;Thanks JoseCruzCat.&amp;nbsp; Unfortunately that does the average correctly, but it does not work when trying to calculate a weighted average.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 21:40:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/957593#M11065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-03T21:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/958180#M11085</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this might help you to solve your problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Weighted&amp;nbsp;=&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Keyword"&gt;SUM&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;'Table'[weight]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN class="Parenthesis"&gt; &lt;SPAN&gt;(COUNTROWS('Table') - COUNTROWS(FILTER('Table','Table'[weight]=0)))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:05:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/958180#M11085</guid>
      <dc:creator>piyushszope</dc:creator>
      <dc:date>2020-03-04T08:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/958974#M11123</link>
      <description>&lt;P&gt;Thanks but that doesn't work either.&amp;nbsp; Here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customers supply their yearly income and their age.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not all of the customers supply their age but do supply their yearly income.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would want to take the weighted average of the age of customers by their incomes.&amp;nbsp; For customers who don't supply their age I want to exclude their income and the entire row in the calcuations.&amp;nbsp; Within Excel it would be (Age*Yearly Income)/Yearly Income after deleting all of the rows of the customers who didn't supply their age.&amp;nbsp; So basically I would want PowerBI to exclude the rows where the age is blank and only do the function on rows with both data sets in the query.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 15:50:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/958974#M11123</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-04T15:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/959078#M11128</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// For all visible customers in the Customers
// dimension table the formula will calculate
// the age-weighted average income using
// only those customers that have supplied
// their age.

// Remember that a BLANK is treated as
// either '' (strings) or 0 (numbers),
// therefore the below is enough to get
// the weighted average.

[Age-Weighted Average Income] =
var __numerator =
	SUMX(
		Customers,
		Customers[Age] * Customers[Income]
	)
var __denominator = SUM( Customers[Age] )
var __avg =
	DIVIDE( __numerator, __denominator )
return
	__avg&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And a mirror measure...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Income-Weighted Average Age] =
var __numerator =
	SUMX(
		Customers,
		Customers[Age] * Customers[Income]
	)
var __denominator =	SUM( Customers[Income] )
var __avg =
	DIVIDE( __numerator, __denominator )
return
	__avg&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 16:52:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-Averages/m-p/959078#M11128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-04T16:52:27Z</dc:date>
    </item>
  </channel>
</rss>

