<?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: Averageif based con current line in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903003#M94604</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="470763" data-lia-user-login="stefanot" class="lia-mention lia-mention-user"&gt;stefanot&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AverageNumberofSALES = CALCULATE(AVERAGE('Table'[SALES]),ALLEXCEPT('Table','Table'[Product]))&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Jianbo Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 07:59:10 GMT</pubDate>
    <dc:creator>v-jianboli-msft</dc:creator>
    <dc:date>2022-11-14T07:59:10Z</dc:date>
    <item>
      <title>Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900728#M94466</link>
      <description>&lt;P&gt;Hallo, I've found similar questions to mine in the forum, but it looks like none of them is really what I'm looking for&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In PowerPivot/DAX I want to create a measure that represents an averageif of sales for each kind of products, like in the example below:&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;Product&lt;/TD&gt;&lt;TD&gt;SALES&lt;/TD&gt;&lt;TD&gt;averageif&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;drink&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;drink&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;food&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other discussions I see solutions like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AverageNumberofSALES=Calculate(average(Table[SALES]),Filter(Table, Table[Product]=&lt;U&gt;"drink"&lt;/U&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but in my case instead of inputing &lt;U&gt;"drink&lt;/U&gt;" i'd like to tell in DAX &lt;U&gt;"current value of any single row"&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 17:30:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900728#M94466</guid>
      <dc:creator>stefanot</dc:creator>
      <dc:date>2022-11-11T17:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900826#M94470</link>
      <description>&lt;P&gt;You didn't say what you really want, a measure or a calculated column...&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 18:45:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900826#M94470</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-11T18:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900904#M94474</link>
      <description>&lt;P&gt;a calculated column.&lt;/P&gt;&lt;P&gt;the objective later on is to create a measure that can calculate the difference between the sales of any selected line in the pivot and the fixed number (so not changing based on how you play with the pivot) of average sales of that specific product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope this clarifies, thanks for your message!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 19:54:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2900904#M94474</guid>
      <dc:creator>stefanot</dc:creator>
      <dc:date>2022-11-11T19:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2901303#M94505</link>
      <description>&lt;LI-CODE lang="csharp"&gt;[SalesAverageIf] = // calc column
var CurrentProd = T[Product]
var Result =
    AVERAGEX(
        FILTER(
            T,
            T[Product] = CurrentProd
        ),
        T[Sales]
    )
return
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Nov 2022 11:02:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2901303#M94505</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-12T11:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903003#M94604</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="470763" data-lia-user-login="stefanot" class="lia-mention lia-mention-user"&gt;stefanot&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AverageNumberofSALES = CALCULATE(AVERAGE('Table'[SALES]),ALLEXCEPT('Table','Table'[Product]))&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Jianbo Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 07:59:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903003#M94604</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-11-14T07:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903049#M94611</link>
      <description>&lt;P&gt;This works perfectly, thanks!&lt;/P&gt;&lt;P&gt;let me take the chance for an additional question though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;imagine you have an additional variable of status:&amp;nbsp;&lt;/P&gt;&lt;P&gt;PRODUCTSTATUSSALES&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DRINK&lt;/TD&gt;&lt;TD&gt;SOLD&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DRINK&lt;/TD&gt;&lt;TD&gt;PROPOSED&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FOOD&lt;/TD&gt;&lt;TD&gt;PROPOSED&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can you get the average if that changes depending on whether you filter by status (eg the average of only sold drinks would become 1)?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 08:14:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903049#M94611</guid>
      <dc:creator>stefanot</dc:creator>
      <dc:date>2022-11-14T08:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Averageif based con current line</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903083#M94612</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="470763" data-lia-user-login="stefanot" class="lia-mention lia-mention-user"&gt;stefanot&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can achieve this by changing the aggregation of SALES directly:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Besides, this question is beyond the topic discussed at the beginning of the thread. So to be able to better help other users, if you still have any other questions, please consider marking the replies that are useful to you and creating a thread about the new topic, which will allow the thread to be addressed more efficiently.&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 08:27:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Averageif-based-con-current-line/m-p/2903083#M94612</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-11-14T08:27:15Z</dc:date>
    </item>
  </channel>
</rss>

