<?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 per row based on slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011685#M102125</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297277" data-lia-user-login="danielcontente" class="lia-mention lia-mention-user"&gt;danielcontente&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; Can you share a sample of the relevant tables in your model? Or, ideally, the pbix?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. &lt;/STRONG&gt;How are the "2 previous years" determined? Is it always 2020 and 2021 or dynamic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 16:01:36 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2023-01-10T16:01:36Z</dc:date>
    <item>
      <title>Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011462#M102109</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a table and would like to create a measure that will average the values per row for the 2 previous years.&lt;/P&gt;&lt;P&gt;In the below table, the result for WEEK 41, for example, would be 487,003 (average of 2020 and 2021)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 14:51:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011462#M102109</guid>
      <dc:creator>danielcontente</dc:creator>
      <dc:date>2023-01-10T14:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011685#M102125</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297277" data-lia-user-login="danielcontente" class="lia-mention lia-mention-user"&gt;danielcontente&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; Can you share a sample of the relevant tables in your model? Or, ideally, the pbix?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. &lt;/STRONG&gt;How are the "2 previous years" determined? Is it always 2020 and 2021 or dynamic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:01:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011685#M102125</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2023-01-10T16:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011688#M102127</link>
      <description>&lt;P&gt;Hi, the table is in the first comment (there is a picture).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:03:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011688#M102127</guid>
      <dc:creator>danielcontente</dc:creator>
      <dc:date>2023-01-10T16:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011689#M102128</link>
      <description>&lt;P&gt;the previous two years are dynamic&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:04:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011689#M102128</guid>
      <dc:creator>danielcontente</dc:creator>
      <dc:date>2023-01-10T16:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011701#M102130</link>
      <description>&lt;P&gt;I cannot copy the data from a picture&lt;/P&gt;
&lt;P&gt;Dynamic based on what? Why not 2022 and 2021?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:07:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011701#M102130</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2023-01-10T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011702#M102131</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297277" data-lia-user-login="danielcontente" class="lia-mention lia-mention-user"&gt;danielcontente&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Average = 
VAR _2020 = CALCULATE(SUM(TableName[Value]), YEAR(TableName[Date])=2020)
VAR _2021 = CALCULATE(SUM(TableName[Value]), YEAR(TableName[Date])=2021)
RETURN
(_2020+_2021)/2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:07:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011702#M102131</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-10T16:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011849#M102143</link>
      <description>&lt;P&gt;Dynamic based on the current year.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:13:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3011849#M102143</guid>
      <dc:creator>danielcontente</dc:creator>
      <dc:date>2023-01-10T17:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Average per row based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3012854#M102209</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297277" data-lia-user-login="danielcontente" class="lia-mention lia-mention-user"&gt;danielcontente&lt;/a&gt;&amp;nbsp;,&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 =
var _today=YEAR(TODAY())
var _1year=
SUMX(FILTER(ALL('Table'),'Table'[Year]=_today -1&amp;amp;&amp;amp;'Table'[Weeknumber]=MAX('Table'[Weeknumber])),[Value])
var _2year=
SUMX(FILTER(ALL('Table'),'Table'[Year]=_today -2&amp;amp;&amp;amp;'Table'[Weeknumber]=MAX('Table'[Weeknumber])),[Value])
return
DIVIDE(
    _1year+_2year,2)&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;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>Wed, 11 Jan 2023 05:21:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-per-row-based-on-slicer/m-p/3012854#M102209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-11T05:21:39Z</dc:date>
    </item>
  </channel>
</rss>

