<?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: Conditional average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2548822#M72066</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="356686" data-lia-user-login="Josué" class="lia-mention lia-mention-user"&gt;Josué&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this code to do that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _AllYear0fCode =
    CALCULATETABLE ( VALUES ( 'Table'[year] ), ALLSELECTED ( 'Table'[year] ) )
VAR _SelectedYear =
    CALCULATETABLE ( VALUES ( 'Table'[year] ), ALLSELECTED ( 'Table' ) )
VAR _Compare =
    COUNTROWS ( EXCEPT ( _SelectedYear, _AllYear0fCode ) )
VAR _AVG =
    AVERAGEX ( VALUES ( 'Table'[year] ), SUM ( 'Table'[sales] ) )
RETURN
    IF ( _Compare = 0, _AVG )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2022 02:47:39 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-05-31T02:47:39Z</dc:date>
    <item>
      <title>Conditional average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2536360#M71285</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm new to DAX measurements and I'm having trouble solving a problem. I need to get the average prices of the products. However, the calculation should consider only products that have data in all selected years. For example, code A has data in 2018, 2019 and 2020, code B in 2018 and 2019, in which case the average must be only for code A. If only the years 2018 and 2019 are segmented, then code B can be calculated . Sounds simple, but with my knowledge I'm not able to find a formula that does this. Here is an example of the table:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 13:19:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2536360#M71285</guid>
      <dc:creator>Josué</dc:creator>
      <dc:date>2022-05-24T13:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2538003#M71396</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="356686" data-lia-user-login="Josué" class="lia-mention lia-mention-user"&gt;Josué&lt;/a&gt; , A measure like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AverageX(Summarize(Table, Table[Year], Table[Product], "_1", Sum(Table[Price])),[_1])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate(AverageX(Summarize(Table, Table[Year], Table[Product], "_1", Sum(Table[Price])),[_1]), allexcept(Table, Table[Product])&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 07:09:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2538003#M71396</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-05-25T07:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2548822#M72066</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="356686" data-lia-user-login="Josué" class="lia-mention lia-mention-user"&gt;Josué&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this code to do that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _AllYear0fCode =
    CALCULATETABLE ( VALUES ( 'Table'[year] ), ALLSELECTED ( 'Table'[year] ) )
VAR _SelectedYear =
    CALCULATETABLE ( VALUES ( 'Table'[year] ), ALLSELECTED ( 'Table' ) )
VAR _Compare =
    COUNTROWS ( EXCEPT ( _SelectedYear, _AllYear0fCode ) )
VAR _AVG =
    AVERAGEX ( VALUES ( 'Table'[year] ), SUM ( 'Table'[sales] ) )
RETURN
    IF ( _Compare = 0, _AVG )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 02:47:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-average/m-p/2548822#M72066</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-05-31T02:47:39Z</dc:date>
    </item>
  </channel>
</rss>

