<?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 by months excluding current month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085934#M107865</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="469741" data-lia-user-login="sgeorge930" class="lia-mention lia-mention-user"&gt;sgeorge930&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) try to add a column like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Month = FORMAT([Date], "YYYYMM")&lt;/LI-CODE&gt;&lt;P&gt;2) write a measure like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
AVERAGEX(
   CALCULATETABLE(
       VALUES(TableName[Month]),
       TableName[Month] &amp;lt; FORMAT(TODAY(), "YYYYMM")
   ),
    CALCULATE(SUM(TableName[Credits]))
)&lt;/LI-CODE&gt;&lt;P&gt;it worked like:&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;</description>
    <pubDate>Sat, 18 Feb 2023 04:49:39 GMT</pubDate>
    <dc:creator>FreemanZ</dc:creator>
    <dc:date>2023-02-18T04:49:39Z</dc:date>
    <item>
      <title>Average by months excluding current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085710#M107836</link>
      <description>&lt;P&gt;My brain has not been working properly when thinking of DAX, any advice would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a measure to calculate the average number of credits used per month excluding the current month.&lt;/P&gt;&lt;P&gt;For example:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Credits used&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/15/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/17/2022&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/6/2023&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/4/2023&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So then it would need to summerize by month and then average per month excluding February as the current month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result would be: 10.5 credits used on average per month (excluding current month)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There must be an easy way to write this in DAX, I just have been annoyingly stuck on this fairlyy simple one.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 21:21:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085710#M107836</guid>
      <dc:creator>sgeorge930</dc:creator>
      <dc:date>2023-02-17T21:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Average by months excluding current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085881#M107854</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="469741" data-lia-user-login="sgeorge930" class="lia-mention lia-mention-user"&gt;sgeorge930&lt;/a&gt; , prefer to use a date table joined date of you table having month year &lt;/P&gt;
&lt;P&gt;calculate(&lt;/P&gt;
&lt;P&gt;Averagex(Values(Date[Month Year]), calculate(Sum(Table[Credit Used])) ) , filter(all(Date), eomonth(date[Date],0) &amp;lt;&amp;gt; eomonth(today(),0) ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;to get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :&lt;A href="https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions" target="_blank"&gt;radacad&lt;/A&gt; &lt;A href="https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/" target="_blank"&gt;sqlbi&lt;/A&gt; &lt;A href="https://www.youtube.com/playlist?list=PLPaNVDMhUXGYLz-w8ERQOo3KYARs7GgG-" target="_blank"&gt;My Video Series&lt;/A&gt; Appreciate your Kudos. &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 03:25:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085881#M107854</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-02-18T03:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Average by months excluding current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085934#M107865</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="469741" data-lia-user-login="sgeorge930" class="lia-mention lia-mention-user"&gt;sgeorge930&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) try to add a column like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Month = FORMAT([Date], "YYYYMM")&lt;/LI-CODE&gt;&lt;P&gt;2) write a measure like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
AVERAGEX(
   CALCULATETABLE(
       VALUES(TableName[Month]),
       TableName[Month] &amp;lt; FORMAT(TODAY(), "YYYYMM")
   ),
    CALCULATE(SUM(TableName[Credits]))
)&lt;/LI-CODE&gt;&lt;P&gt;it worked like:&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;</description>
      <pubDate>Sat, 18 Feb 2023 04:49:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-by-months-excluding-current-month/m-p/3085934#M107865</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-18T04:49:39Z</dc:date>
    </item>
  </channel>
</rss>

