<?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: How to calculate average of sum for each month from all yeras in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3906025#M152166</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;Worth mentioning that the following should work &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;TEST =
AVERAGEX (
    CALCULATETABLE (
        SUMMARIZE ( 'Calendar', 'Calendar'[Year], 'Calendar'[Month] ),
        ALL ( 'Calendar'[Year] )
    ),
    CALCULATE (
        CALCULATE (
            SUM ( Kontrakty[wolumenJednostkowy] ),
            FILTER ( Kontrakty, Kontrakty[gielda] = "TGE" )
        )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2024 15:57:17 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2024-05-09T15:57:17Z</dc:date>
    <item>
      <title>How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903037#M152088</link>
      <description>&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;How to calculate average of sum for each month from all yeras&lt;/P&gt;&lt;P class=""&gt;Hello I'm wondering how solve problem with calculate average of sum in each month.&amp;nbsp;&lt;BR /&gt;I got 2 tables, first is Calendar&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Month&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Year&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2021-01-01&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;2021&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;.....&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2024-05-07&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;2024&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Second table &amp;nbsp;which name is Data&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Sales&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2021-01-01&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2021-01-02&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;15&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;.....&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2024-05-06&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;13&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2024-05-07&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I Have TotalSales = SUMX(Data,Data[Sales])&lt;/P&gt;&lt;P class=""&gt;I need recive table like below&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;Year&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Month&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Total Sales&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;Average sales of Month&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;500&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;450&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;600&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;800&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2024&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;400&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;450&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;2024&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;1000&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;800&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;...&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class=""&gt;&lt;BR /&gt;I Can resolve that problem but its require make a new table (SUMMERIZe, ...) , im looking something better tyo resolve that&lt;/P&gt;&lt;P class=""&gt;Conclusion .&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I woul like recive measure which will be Avarage of Total Sales for each month from data.range. so avarage should&amp;nbsp; be the same for May 2023. 2024 etc&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 17:48:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903037#M152088</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-08T17:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903068#M152089</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;Average Sales =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;CALCULATETABLE ( VALUES ( 'Calendar'[Month] ), ALL ( 'Calendar'[Year] ) ),&lt;BR /&gt;[Total Sales]&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 17:58:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903068#M152089</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-08T17:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903224#M152090</link>
      <description>&lt;P&gt;I recived from measure&amp;nbsp;&lt;SPAN&gt;Average Sales&amp;nbsp;&lt;/SPAN&gt;value equal&amp;nbsp; of total sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;doesnt work correctly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 18:49:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3903224#M152090</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-08T18:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904013#M152110</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes you are right&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Average Sales =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;CALCULATETABLE ( VALUES ( 'Calendar'[Month] ), ALL ( 'Calendar'[Year] ) ),&lt;BR /&gt;CALCULATE ( [Total Sales], ALL ( 'Calendar'[Year] ) )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 03:42:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904013#M152110</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T03:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904218#M152114</link>
      <description>&lt;P&gt;still doesnt work . The same result&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 06:08:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904218#M152114</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T06:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904350#M152116</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Same result? Strainge!... Wrong result? Ture.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Average Sales = 
AVERAGEX (
    CALCULATETABLE ( 
        SUMMARIZE ( 'Date', 'Date'[Year],'Date'[Month Number] ), 
        ALL ( 'Date'[Year] ) 
    ),
    [Sales Amount]
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 06:56:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904350#M152116</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T06:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904621#M152131</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; im completely confused why its doesnt work for my case.&lt;BR /&gt;i put below screen of my formul and table result (righr down corner)&lt;BR /&gt;&lt;BR /&gt;DAX is like a hell... in python I can do it in 2 sec...&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 08:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904621#M152131</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T08:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904905#M152136</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't use variable. Place the CALCULATE formula directly inside the AVERAGEX otherwise the context transition won't take effect&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 09:59:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3904905#M152136</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T09:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905272#M152144</link>
      <description>&lt;P&gt;Still doesn't work ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 11:29:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905272#M152144</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T11:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905342#M152146</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see the table header. Are you placing the correct measure in the table?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 11:48:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905342#M152146</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T11:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905606#M152151</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; my table&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 12:58:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905606#M152151</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T12:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905638#M152152</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems to be working. Correct me if I'm wrong. However, referencing the complete table inside a CACLULATE filter brings up the complete extended table which incudes 'Calendar'[Date]. Including this cilumn in the filter context would break the formula. I would recommend using&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TEST =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;CALCULATETABLE (&lt;BR /&gt;SUMMARIZE ( 'Calendar', 'Calendar'[Year], 'Calendar'[Month] ),&lt;BR /&gt;ALL ( 'Calendar'[Year] )&lt;BR /&gt;),&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUMX (&lt;BR /&gt;FILTER ( Kontrakty, Kontrakty[gielda] = "TGE" ),&lt;BR /&gt;Kontrakty[wolumenJednostkowy]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 13:11:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905638#M152152</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T13:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905664#M152153</link>
      <description>&lt;P&gt;It's work ! Thanks ,&lt;/P&gt;&lt;P&gt;can you explain how come first method doesn't work ? &amp;nbsp;Second method with filter work correct ? I'm &amp;nbsp;confused&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 13:21:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905664#M152153</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T13:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905908#M152159</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;With CALCULATE wrapping our formula the SUMMARIZE table wich is composed of 'Calendar'[Year] &amp;amp; 'Calendar'[Month] is converted to a new filter context replacing the original table visual filter context which was also composed of the very same two columns. To explain further let's take the &lt;U&gt;&lt;STRONG&gt;first row&lt;/STRONG&gt;&lt;/U&gt; as per your last screenshot as an example:&lt;/P&gt;
&lt;P&gt;The filter context of this row originally contained&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Original Filter Context&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Year&lt;/TD&gt;
&lt;TD width="50%"&gt;Month&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2026&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Then it is replace by the CLACULATETABLE - SUMMARIZE table due to the effect of context transition of the CALCULATE that wraps our formula inside the iterator function AVERAGEX. This overwriting of the filter context produced a new one as follows&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CALCULATE Filter Context1&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Year&lt;/TD&gt;
&lt;TD width="50%"&gt;Month&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2026&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2025&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2024&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;etc..&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Because we have removed&amp;nbsp;the filter from the Year column using ALL and therefore we have now all the years not only 2026 and thus the formula placed inside CALCULATE is evaluated within this filter context as follows:&lt;/P&gt;
&lt;P&gt;AVERAGEX will iterate this table (which contains as many rows as number of years available in the 'Calendar' table) row by row and evaluate the sum of the column&amp;nbsp;&lt;SPAN&gt;Kontrakty[wolumenJednostkowy] for every row&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;Year&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;Month&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;Aggregation1&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;Filter&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;2026&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;12&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;SUM(&lt;SPAN&gt;Kontrakty[wolumenJednostkowy])&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;Y2026 / M12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;2025&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;12&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;SUM(&lt;SPAN&gt;Kontrakty[wolumenJednostkowy])&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;Y2025 / M12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;etc..&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;12&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;SUM(&lt;SPAN&gt;Kontrakty[wolumenJednostkowy])&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;etc..&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Then AVERAGEX will take the sum of Aggregation1 then divide over the number of rows to produce the average.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;My latest formula&amp;nbsp;will follow the same as above except that the SUM will aggregate&amp;nbsp;only the rows where&amp;nbsp;Kontrakty[gielda] = "TGE"&amp;nbsp;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The case when you introduce a filter inside CALCULATE which is already inside an iterator function, things become much more complicated. CALCULATE creates a new filter context out&amp;nbsp;of the iterated table but it also creates a new filter context out of the filter argument inside it. Now when you filter&amp;nbsp;a complete table inside CALCULATE, the resulted table becomes part of the filter context. When you refer to table like&amp;nbsp;&lt;U&gt;Kontrakty&lt;/U&gt;&amp;nbsp;then the engine includes all the columns of this table along with all its extensions (the extended fact table includes also all the columns of all the dimension&amp;nbsp;tables that are connected with it in a one-many unidirectional relationship) in another filter context which will then be intersected with the one it created the first time while iteration the summary table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is that table (&lt;U&gt;Kontrakty&lt;/U&gt;) is evaluated in the outer filter context which is the very original filter context of the visual itself&amp;nbsp;which is composed of year 2026 and the month 12.&lt;/P&gt;
&lt;P&gt;And given that the columns of the 'Calendar' table are part of the extended&amp;nbsp;(&lt;U&gt;Kontrakty&lt;/U&gt;) table and that Year and Month are columns in the 'Calendar' table and that they are evaluated in the outer filter context, then the 2nd filter context that CALCULATE creates is&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CALCULATE Filter Context 2&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Year&lt;/TD&gt;
&lt;TD width="50%"&gt;Month&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2026&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;The intersection between&amp;nbsp;CALCULATE Filter Context 1 and&amp;nbsp;CALCULATE Filter Context 2 is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Final CALCULATE Filter Context&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Year&lt;/TD&gt;
&lt;TD width="50%"&gt;Month&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2026&lt;/TD&gt;
&lt;TD width="50%"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see we're back to the original filter context &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Probably you did not understand any word of all above which is totally normal. It is really&amp;nbsp;unnecessarily complicated. &lt;BR /&gt;Long story short, try to avoid using CALCULATE as mush as you can and rather rely more on a NoCALCULATE approach introduced by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 15:05:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3905908#M152159</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T15:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3906002#M152165</link>
      <description>&lt;P&gt;It's difficult but I see the point &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; thanks you so much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 15:47:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3906002#M152165</guid>
      <dc:creator>adii</dc:creator>
      <dc:date>2024-05-09T15:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate average of sum for each month from all yeras</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3906025#M152166</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454859" data-lia-user-login="adii" class="lia-mention lia-mention-user"&gt;adii&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;Worth mentioning that the following should work &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;TEST =
AVERAGEX (
    CALCULATETABLE (
        SUMMARIZE ( 'Calendar', 'Calendar'[Year], 'Calendar'[Month] ),
        ALL ( 'Calendar'[Year] )
    ),
    CALCULATE (
        CALCULATE (
            SUM ( Kontrakty[wolumenJednostkowy] ),
            FILTER ( Kontrakty, Kontrakty[gielda] = "TGE" )
        )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 15:57:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-average-of-sum-for-each-month-from-all-yeras/m-p/3906025#M152166</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-05-09T15:57:17Z</dc:date>
    </item>
  </channel>
</rss>

