<?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 AVERAGEX - calculated vertically instead of horizontal in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4097787#M162600</link>
    <description>&lt;P&gt;hello Experts,&lt;/P&gt;&lt;P&gt;I hope you can help me with a challange:&lt;/P&gt;&lt;P&gt;Very "boiled down", I have four tables in Power BI, "customer" (columns: customer, customer chain), "Activity" (column: "number of contacts made to the customer"), "Organisation" (column: "Sales person").&lt;/P&gt;&lt;P&gt;I have a "matrix"-visual showing the average number of contacts per customer on "Chain"-level for each Sales person:&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;now, If I want to&amp;nbsp; calculate the average of chains for each sales person, I have made this measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average contact per Chain= 
VAR ChainAverage = 
    AVERAGEX( 
       'Activity', 
       'activity'[index] 
   ) 
RETURN 
    AVERAGEX( 
        VALUES('Customer'[Customer Chain]), 
           ChainAverage 
   )&lt;/LI-CODE&gt;&lt;P&gt;which, in essense, works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, my problem is that the&amp;nbsp; "Average total" is not correct (if I manually calculate the average shown, I get the averages shown in red). I expect the reason for this is that power bi calculates on the row in context. I.e. it calculates the "Average total" horizontal. What I need, is to "force" the measure to calculate the average vertically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do anyone know how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks. All ideas are much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Jayjay0306&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 14:05:20 GMT</pubDate>
    <dc:creator>jayjay0306</dc:creator>
    <dc:date>2024-08-13T14:05:20Z</dc:date>
    <item>
      <title>AVERAGEX - calculated vertically instead of horizontal</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4097787#M162600</link>
      <description>&lt;P&gt;hello Experts,&lt;/P&gt;&lt;P&gt;I hope you can help me with a challange:&lt;/P&gt;&lt;P&gt;Very "boiled down", I have four tables in Power BI, "customer" (columns: customer, customer chain), "Activity" (column: "number of contacts made to the customer"), "Organisation" (column: "Sales person").&lt;/P&gt;&lt;P&gt;I have a "matrix"-visual showing the average number of contacts per customer on "Chain"-level for each Sales person:&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;now, If I want to&amp;nbsp; calculate the average of chains for each sales person, I have made this measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average contact per Chain= 
VAR ChainAverage = 
    AVERAGEX( 
       'Activity', 
       'activity'[index] 
   ) 
RETURN 
    AVERAGEX( 
        VALUES('Customer'[Customer Chain]), 
           ChainAverage 
   )&lt;/LI-CODE&gt;&lt;P&gt;which, in essense, works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, my problem is that the&amp;nbsp; "Average total" is not correct (if I manually calculate the average shown, I get the averages shown in red). I expect the reason for this is that power bi calculates on the row in context. I.e. it calculates the "Average total" horizontal. What I need, is to "force" the measure to calculate the average vertically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do anyone know how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks. All ideas are much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Jayjay0306&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 14:05:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4097787#M162600</guid>
      <dc:creator>jayjay0306</dc:creator>
      <dc:date>2024-08-13T14:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: AVERAGEX - calculated vertically instead of horizontal</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4098079#M162613</link>
      <description>&lt;P&gt;Your second AVERAGEX isn't doing anything since ChainAverage is a constant value once it's defined (it's the same for each row in the customer chain iterator).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you might want something more like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;AVERAGEX (
    SUMMARIZE (
        Activity,
        Customer[Customer Chain],
        "@ChainAvg", AVERAGE ( activity[index] )
    ),
    [@ChainAvg]
)&lt;/LI-CODE&gt;
&lt;P&gt;(This assumes you have a one-to-many relationship from Customer to Activity.)&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 16:05:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4098079#M162613</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-08-13T16:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: AVERAGEX - calculated vertically instead of horizontal</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4099288#M162672</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="139186" data-lia-user-login="jayjay0306" class="lia-mention lia-mention-user"&gt;jayjay0306&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I create a table as you mentioned.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then I put it into the matrix visual.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you want the vertical average column you are talking about, I think you can just make the change.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Yilong Zhou&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&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>Wed, 14 Aug 2024 05:31:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4099288#M162672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-14T05:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: AVERAGEX - calculated vertically instead of horizontal</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4099517#M162683</link>
      <description>&lt;P&gt;Thanks AlexisOlson, it is exactly what I want.&lt;/P&gt;&lt;P&gt;bloody brilliant &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;br,&lt;/P&gt;&lt;P&gt;Jayjay0306&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 07:21:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/AVERAGEX-calculated-vertically-instead-of-horizontal/m-p/4099517#M162683</guid>
      <dc:creator>jayjay0306</dc:creator>
      <dc:date>2024-08-14T07:21:29Z</dc:date>
    </item>
  </channel>
</rss>

