<?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: Getting an average purchased price in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854586#M91689</link>
    <description>&lt;P&gt;Hi Greg! Thank you for your answer.&lt;/P&gt;&lt;P&gt;That's not working, I think because I need to keep the filter of a specific product, using ALL removes that filter.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 23:37:57 GMT</pubDate>
    <dc:creator>AndresOHV</dc:creator>
    <dc:date>2022-10-20T23:37:57Z</dc:date>
    <item>
      <title>Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854437#M91675</link>
      <description>&lt;P&gt;Hello all!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a problem with a measure. Total QTY is ok, I want it to show the total purchased regardless the filter context.&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;The problem is that I try to get the average price this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;As you can see in the table, the measure it's not dividing by the total quantity (1028), instead it's doing it by the normal quantity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 20:59:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854437#M91675</guid>
      <dc:creator>AndresOHV</dc:creator>
      <dc:date>2022-10-20T20:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854444#M91676</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="455001" data-lia-user-login="AndresOHV" class="lia-mention lia-mention-user"&gt;AndresOHV&lt;/a&gt;&amp;nbsp;Perhaps try CALCULATE([Total Qty], ALL('Table')&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 21:03:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854444#M91676</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-10-20T21:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854586#M91689</link>
      <description>&lt;P&gt;Hi Greg! Thank you for your answer.&lt;/P&gt;&lt;P&gt;That's not working, I think because I need to keep the filter of a specific product, using ALL removes that filter.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 23:37:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854586#M91689</guid>
      <dc:creator>AndresOHV</dc:creator>
      <dc:date>2022-10-20T23:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854588#M91690</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="455001" data-lia-user-login="AndresOHV" class="lia-mention lia-mention-user"&gt;AndresOHV&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;please try the below im not sure if i understood you correctly but pleaae try:&lt;BR /&gt;create 2 measures first one is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total QTY = CALCULATE(SUM(HelpBi[Purchase Qtty]),ALL(HelpBi))&lt;/LI-CODE&gt;&lt;P&gt;the second one is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average Price = SUMX(HelpBi,DIVIDE((HelpBi[Purchase Qtty]*HelpBi[Price]),[Total QTY],0))&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 23:40:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854588#M91690</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-20T23:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854598#M91694</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;I'm copying the table below with an extra column (productId).&lt;/P&gt;&lt;P&gt;The problem of using ALL is that it removes the product filter and I need the measure to calculate the average price for the selected product so using ALL is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Product Id&lt;/TD&gt;&lt;TD&gt;Purchase qty&lt;/TD&gt;&lt;TD&gt;Price&lt;/TD&gt;&lt;TD&gt;Total QTY&lt;/TD&gt;&lt;TD&gt;Average Price&lt;/TD&gt;&l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2022 00:00&lt;/TD&gt;&lt;TD&gt;149&lt;/TD&gt;&lt;TD&gt;-557&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1028&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/1/2022 00:00&lt;/TD&gt;&lt;TD&gt;149&lt;/TD&gt;&lt;TD&gt;557&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1028&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 20 Oct 2022 23:59:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854598#M91694</guid>
      <dc:creator>AndresOHV</dc:creator>
      <dc:date>2022-10-20T23:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854612#M91697</link>
      <description>&lt;P&gt;hello thank you for providing details,&amp;nbsp;&lt;BR /&gt;kidly change the first measure i provided to :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;total qtty = CALCULATE(SUM(HelpBi[Purchase Qtty]),ALL(HelpBi),HelpBi[ID]=MAX(HelpBi[ID]))&lt;/LI-CODE&gt;&lt;P&gt;i added some sample to show you how it work:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; please tell me if it works if it does please accept as solution to help other users&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 00:20:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854612#M91697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-21T00:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an average purchased price</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854613#M91698</link>
      <description>&lt;P&gt;Thank you so much Anonymous&lt;/a&gt;&amp;nbsp;! This was exactly what I was needing!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 00:26:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-an-average-purchased-price/m-p/2854613#M91698</guid>
      <dc:creator>AndresOHV</dc:creator>
      <dc:date>2022-10-21T00:26:29Z</dc:date>
    </item>
  </channel>
</rss>

