<?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: Average in a matrix with different hierarchies in power bi in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3734086#M145536</link>
    <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;BR /&gt;&lt;SPAN class=""&gt;But that doesn't solve my problem&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Feb 2024 16:00:46 GMT</pubDate>
    <dc:creator>Yeimy</dc:creator>
    <dc:date>2024-02-29T16:00:46Z</dc:date>
    <item>
      <title>Average in a matrix with different hierarchies in power bi</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3731716#M145425</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a matrix with 4 levels, the fist level comes from a column of the date dim and the remainig 3 levels are from the produt dimension, i also have a measure called und sale wich is the sum of the sale units&lt;BR /&gt;&lt;BR /&gt;What i want is to take the average, tha is, for my hormonal group the units of all the available months are added and divided by two (the average) then the same for the anti-pain group and so on for the others groups and the same for the others levels of hierarchy&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have usued these dax:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGEX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(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SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DIM_FECHA&lt;/SPAN&gt;&lt;SPAN&gt;[M-Y]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;But it doesn't show me the average but rather the current units or just the average of the total&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 21:46:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3731716#M145425</guid>
      <dc:creator>Yeimy</dc:creator>
      <dc:date>2024-02-28T21:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Average in a matrix with different hierarchies in power bi</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3732304#M145455</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="614015" data-lia-user-login="Yeimy" class="lia-mention lia-mention-user"&gt;Yeimy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Are you referring to the different levels of Row subtotals showing the average for that level.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Measure follows the context of the "Total" row and is calculated in that context. Therefore, using a measure in a column of a table visualization may have unexpected values in the "Total" column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can consider using the switch() + Isinscope() function to determine the corresponding level in the matrix, and use the corresponding rule based on the corresponding level&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/switch-function-dax" target="_blank"&gt;SWITCH function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/isinscope-function-dax" target="_blank"&gt;ISINSCOPE function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
SWITCH(
    TRUE(),
    ISINSCOPE('Table'[Group4]),1,
    ISINSCOPE('Table'[Group3]),2,
    ISINSCOPE('Table'[Group2]),3,
    ISINSCOPE('Table'[Group1]),4,0)&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 04:35:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3732304#M145455</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-29T04:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Average in a matrix with different hierarchies in power bi</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3734086#M145536</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;BR /&gt;&lt;SPAN class=""&gt;But that doesn't solve my problem&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 16:00:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-in-a-matrix-with-different-hierarchies-in-power-bi/m-p/3734086#M145536</guid>
      <dc:creator>Yeimy</dc:creator>
      <dc:date>2024-02-29T16:00:46Z</dc:date>
    </item>
  </channel>
</rss>

