<?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: Calculate the Average of a measure over selected months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675947#M79965</link>
    <description>&lt;P&gt;Thanks Barthel!&lt;BR /&gt;&lt;BR /&gt;I tried your code and have different results (which is good) but not what we are looking for. Here is a screentshot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2022 14:55:00 GMT</pubDate>
    <dc:creator>Lindino08</dc:creator>
    <dc:date>2022-08-02T14:55:00Z</dc:date>
    <item>
      <title>Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675726#M79946</link>
      <description>&lt;P&gt;Hello Power Bi Community! Hoping someone can help me out.&lt;BR /&gt;&lt;BR /&gt;I have a measure which calulates the "Incident Rate" (IR). Formula for IR is:&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;IR = &lt;/SPAN&gt;&lt;SPAN&gt;'Injury Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Recordable Injuries]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;200000&lt;/SPAN&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;SPAN&gt;'Injury Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Total Working Hours]&lt;BR /&gt;&lt;BR /&gt;We have the IR placed on a monthly bar graph which is correct. Now we would like to add a Line y-axis to show a cumulative average of the IR based on the selected Months.&lt;BR /&gt;&lt;BR /&gt;Red line is what I have drawn and need to create a formula for.&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Aug 2022 13:39:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675726#M79946</guid>
      <dc:creator>Lindino08</dc:creator>
      <dc:date>2022-08-02T13:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675847#M79955</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming you have a calendar table called 'Calendar', this is the code you can use for a measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Cumulative Average =
VAR CurrentDate =
    MAX ( Calendar[Date] )
RETURN
    CALCULATE (
        'Injury Data'[Recordable Injuries] * 200000 / 'Injury Data'[Total Working Hours],
        ALLSELECTED ( Calendar ),
        Calendar[Date] &amp;lt;= CurrentDate
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of redefining the IR measure in the above code, you can also refer to your already existing IR measure.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 14:22:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675847#M79955</guid>
      <dc:creator>Barthel</dc:creator>
      <dc:date>2022-08-02T14:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675947#M79965</link>
      <description>&lt;P&gt;Thanks Barthel!&lt;BR /&gt;&lt;BR /&gt;I tried your code and have different results (which is good) but not what we are looking for. Here is a screentshot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 14:55:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2675947#M79965</guid>
      <dc:creator>Lindino08</dc:creator>
      <dc:date>2022-08-02T14:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676482#M80001</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just thinking out loud here. What kind of column is the 'Month' column? A string or value? The VAR CurrentDate must take the MAX of a value column, so that the less than or equal to statement works logically. Is that the case?&amp;nbsp;If not, take the MAX of the column on which you base the sort order of 'Month', rather than 'Month' itself.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 19:51:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676482#M80001</guid>
      <dc:creator>Barthel</dc:creator>
      <dc:date>2022-08-02T19:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676498#M80004</link>
      <description>&lt;P&gt;Good thoughts! I tried to change it to a calendar value column that I am pulling the month name from. Here is what I get. The second screen shot is of the relationship between the two tables I have and you can see the date columns.&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 20:05:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676498#M80004</guid>
      <dc:creator>Lindino08</dc:creator>
      <dc:date>2022-08-02T20:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676514#M80007</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it's because the ALLSELECTED function doesn't work properly this way. Could you try this code?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Cumulative Average =
VAR MinDate =
    CALCULATE ( MIN ( 'Employee Hours'[Date (Start of Month]) ), ALLSELECTED ( 'Employee Hours' ) )
VAR MaxDate =
    MAX ( 'Employee Hours'[Date (Start of Month])] )
RETURN
    CALCULATE (
        'Injury Data'[Recordable Injuries] * 200000 / 'Injury Data'[Total Working Hours],
        'Employee Hours'[Date (Start of Month])] &amp;gt;= MinDate,
        'Employee Hours'[Date (Start of Month])] &amp;lt;= MaxDate
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Aug 2022 20:19:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676514#M80007</guid>
      <dc:creator>Barthel</dc:creator>
      <dc:date>2022-08-02T20:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the Average of a measure over selected months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676526#M80009</link>
      <description>&lt;P&gt;Prefect! You're Awesome! Thanks for the help.&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 20:29:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-Average-of-a-measure-over-selected-months/m-p/2676526#M80009</guid>
      <dc:creator>Lindino08</dc:creator>
      <dc:date>2022-08-02T20:29:37Z</dc:date>
    </item>
  </channel>
</rss>

