<?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 Calculate weighed average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2833064#M90317</link>
    <description>&lt;P&gt;I want to make a measure that calculate a weighted average of how many minutes our customers have been actively shopping in our store but I can´t for the life of me figure out how to do this in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have these two lines&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;minutesInStore&lt;/TD&gt;&lt;TD&gt;minutesQueue&lt;/TD&gt;&lt;TD&gt;Customers&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to figure out how long time the average customer have spend in my store actively shopping (minutesInStore-minutesQueue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My normal go-to in SQL would be to make a column calculating the total minutes per line (minutesInStore-minutesQueue)*Customers as customerMinutes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;minutesInStore&lt;/TD&gt;&lt;TD&gt;minutesQueue&lt;/TD&gt;&lt;TD&gt;Customers&lt;/TD&gt;&lt;TD&gt;customerMinutes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then the sum of customerMinutes divided by customers (sum(customerMinutes)/sum(customers) as avgMinutes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(250+50)/(10+5)=20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But how can I replicate that in DAX?&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 07:00:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-10-11T07:00:31Z</dc:date>
    <item>
      <title>Calculate weighed average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2833064#M90317</link>
      <description>&lt;P&gt;I want to make a measure that calculate a weighted average of how many minutes our customers have been actively shopping in our store but I can´t for the life of me figure out how to do this in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have these two lines&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;minutesInStore&lt;/TD&gt;&lt;TD&gt;minutesQueue&lt;/TD&gt;&lt;TD&gt;Customers&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to figure out how long time the average customer have spend in my store actively shopping (minutesInStore-minutesQueue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My normal go-to in SQL would be to make a column calculating the total minutes per line (minutesInStore-minutesQueue)*Customers as customerMinutes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;minutesInStore&lt;/TD&gt;&lt;TD&gt;minutesQueue&lt;/TD&gt;&lt;TD&gt;Customers&lt;/TD&gt;&lt;TD&gt;customerMinutes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then the sum of customerMinutes divided by customers (sum(customerMinutes)/sum(customers) as avgMinutes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(250+50)/(10+5)=20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But how can I replicate that in DAX?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 07:00:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2833064#M90317</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-11T07:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate weighed average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2836614#M90522</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Avg Minutes =
VAR CustomerMinutes =
    SUMX (
        'Table',
        ( 'Table'[Minutes in store] - 'Table'[Minutes In Queue] ) * 'Table'[Customers]
    )
VAR Customers =
    SUM ( 'Table'[Customers] )
RETURN
    DIVIDE ( CustomerMinutes, Customers )
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Oct 2022 10:32:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2836614#M90522</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-10-12T10:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate weighed average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2839193#M90676</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;I just want to confirm if you resolved this issue? If yes,&amp;nbsp;&lt;U&gt;you can accept the answer helpful as the solution&lt;/U&gt;&amp;nbsp;&lt;STRONG&gt;or&lt;/STRONG&gt;&amp;nbsp;&lt;U&gt;share you method and accept it as solution&lt;/U&gt;, thanks for your contribution to improve Power BI.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If you need more help, please let me know.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 09:33:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighed-average/m-p/2839193#M90676</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2022-10-13T09:33:45Z</dc:date>
    </item>
  </channel>
</rss>

