<?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 average calculation with a twist in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1358915#M24580</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="257620" data-lia-user-login="wenchi" class="lia-mention lia-mention-user"&gt;wenchi&lt;/a&gt; , if not resolved, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 16:08:19 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2020-09-09T16:08:19Z</dc:date>
    <item>
      <title>weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1355713#M24493</link>
      <description>&lt;P&gt;We have a fact table stores weekly data at store and brand with quantity and unit price. The users need to obtain the volume weighted average price by taking the lates week unit price weighted by the entire selected period quantity at store\brand level. For example, if the user choose week 50 to week 60 time span, the weighted average price is calculated with total volume of that time frame apply with week 60th store\brand price. Since Dax is not supported to create dynamic calculate table ( I thought I can create a dynamic table to store latest price for calculation, but i was wrong), I am kind of stuck to get it calculate correctly. Below are some sample data with calculation based on different weeks selection. Any helps are appreciated. Thanks.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 17:16:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1355713#M24493</guid>
      <dc:creator>wenchi</dc:creator>
      <dc:date>2020-09-08T17:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1356057#M24503</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="257620" data-lia-user-login="wenchi" class="lia-mention lia-mention-user"&gt;wenchi&lt;/a&gt;&amp;nbsp; -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm able to get your desired results for the 1 and 2 week tables showing store and brand, but I'm uncertain as to how the average per brand is calculated.&amp;nbsp; Try this for the Latest Price and Extended Price, and let me know how VWA should be calculated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Latest Price = var __lDate = LASTNONBLANK(WAvg[WE Date], MIN(WAvg[Price]))
return
CALCULATE(MIN(WAvg[Price]), __lDate)

Ext = CALCULATE(SUM(WAvg[Qty]) * [Latest Price])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 20:44:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1356057#M24503</guid>
      <dc:creator>dedelman_clng</dc:creator>
      <dc:date>2020-09-08T20:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1356106#M24505</link>
      <description>&lt;P&gt;I poked around a little more and think I figured out VWA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VWA = var __LNB = LASTNONBLANK(WAvg[WE Date], MIN(WAvg[Qty]))
RETURN
CALCULATE(SUMX(WAvg, [Ext]) / SUM(WAvg[Qty]), __LNB)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 20:43:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1356106#M24505</guid>
      <dc:creator>dedelman_clng</dc:creator>
      <dc:date>2020-09-08T20:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1358915#M24580</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="257620" data-lia-user-login="wenchi" class="lia-mention lia-mention-user"&gt;wenchi&lt;/a&gt; , if not resolved, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 16:08:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1358915#M24580</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-09T16:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1373152#M25044</link>
      <description>&lt;P&gt;I figure it out how to get it to work. with summarized followed by addcomoums, i get the correct number.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 19:47:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1373152#M25044</guid>
      <dc:creator>wenchi</dc:creator>
      <dc:date>2020-09-15T19:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: weighted average calculation with a twist</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1432263#M26709</link>
      <description>&lt;P&gt;Hi Wenchi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you share your solution please? and i suppose you mean AddColumns?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 06:48:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/weighted-average-calculation-with-a-twist/m-p/1432263#M26709</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-14T06:48:38Z</dc:date>
    </item>
  </channel>
</rss>

