<?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: Create a Matrix that has 3,6,12 month averages of measures in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4744292#M181657</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290687" data-lia-user-login="lovekheart" class="lia-mention lia-mention-user"&gt;lovekheart&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend a calculation group containing calculation items for each of the average calculations.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each calculation item's expression should contain &lt;CODE&gt;SELECTEDMEASURE ( )&lt;/CODE&gt; as a placholder for the measure it will be applied to.&lt;/P&gt;
&lt;P&gt;For example, if your averages are defined as arithmetic means of monthly measure values for the last N months (as at the max date filtered), you might use this calculation item expression for "Last 3 months":&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    AVERAGEX (
        VALUES ( 'Date'[Year Month] ), -- or column with month/year granularity
        SELECTEDMEASURE ( )
    ),
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -3, MONTH )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could then construct the matrix with:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Columns:&lt;/STRONG&gt; Calculation group column&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Values:&lt;/STRONG&gt; All required measures&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-matrix-visual-format-settings?tabs=powerbi-desktop#show-values-in-row-groups-rather-than-columns" target="_blank" rel="noopener"&gt;"Show values in rows"&lt;/A&gt; enabled&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Is that enough to go on?&lt;/P&gt;
&lt;P&gt;I could create a small example to demonstrate the setup if that would be useful.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jun 2025 00:48:55 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2025-06-26T00:48:55Z</dc:date>
    <item>
      <title>Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4744154#M181653</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This picture showcases the end goal (sorry i dont have a better example) that i am trying to acheive. I do have a calender table and all the measures but cant seem to find how to achieve this for the matrix visual. Please reach out with any knowldege on this!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 19:00:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4744154#M181653</guid>
      <dc:creator>lovekheart</dc:creator>
      <dc:date>2025-06-25T19:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4744292#M181657</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290687" data-lia-user-login="lovekheart" class="lia-mention lia-mention-user"&gt;lovekheart&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend a calculation group containing calculation items for each of the average calculations.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each calculation item's expression should contain &lt;CODE&gt;SELECTEDMEASURE ( )&lt;/CODE&gt; as a placholder for the measure it will be applied to.&lt;/P&gt;
&lt;P&gt;For example, if your averages are defined as arithmetic means of monthly measure values for the last N months (as at the max date filtered), you might use this calculation item expression for "Last 3 months":&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    AVERAGEX (
        VALUES ( 'Date'[Year Month] ), -- or column with month/year granularity
        SELECTEDMEASURE ( )
    ),
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -3, MONTH )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could then construct the matrix with:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Columns:&lt;/STRONG&gt; Calculation group column&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Values:&lt;/STRONG&gt; All required measures&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-matrix-visual-format-settings?tabs=powerbi-desktop#show-values-in-row-groups-rather-than-columns" target="_blank" rel="noopener"&gt;"Show values in rows"&lt;/A&gt; enabled&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Is that enough to go on?&lt;/P&gt;
&lt;P&gt;I could create a small example to demonstrate the setup if that would be useful.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 00:48:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4744292#M181657</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-06-26T00:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745150#M181689</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;Hi thank you for this. I am still a bit confused (maybe sample will help more). I created the calculation group and by itself on the matrix&amp;nbsp; it pops up correctly before adding values. I changed the values in rows, but my chart is just blank and changes to show "calculation group column" instead of "Last 3 Months"...&lt;BR /&gt;I'm guessing my measures arent created properly for example all of them are in this similar example&lt;BR /&gt;measure = divide([measure 5],[measure 2],0) * 100&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 13:27:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745150#M181689</guid>
      <dc:creator>lovekheart</dc:creator>
      <dc:date>2025-06-26T13:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745916#M181735</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290687" data-lia-user-login="lovekheart" class="lia-mention lia-mention-user"&gt;lovekheart&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Forum Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try modifying the dax measure below&lt;/P&gt;
&lt;P&gt;Measure = AVERAGEX (VALUES ( 'Date'[YearMonth] ),DIVIDE ( [Measure 5], [Measure 2], 0 ) * 100)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Prasanna Kumar&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 03:37:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745916#M181735</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-06-27T03:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745925#M181736</link>
      <description>&lt;P&gt;No worries, here's a sample PBIX.&lt;/P&gt;
&lt;P&gt;The exact definitions of your measures shouldn't matter as long as they are &lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups#:~:text=A%20measure%20or-,explicit%20measure,-occurs%20when%20you" target="_blank" rel="noopener"&gt;explicit measures&lt;/A&gt; (which it sounds like they are) and respond correctly to 'Date' filters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've created two calculation groups in my sample PBIX:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Monthly Averages relative to Filtered Date&lt;/STRONG&gt;&lt;BR /&gt;Computes monthly averages relative to the max date filtered.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Monthly Averages relative to Current Month&lt;BR /&gt;&lt;/STRONG&gt;Computes monthly averages relative to the "current date" as returned by the &lt;CODE&gt;TODAY ( )&lt;/CODE&gt; function.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The calculation item expressions differ only in how they define the "reference date". I've also added variables for readability.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sample calculation items:&lt;/STRONG&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;------------------------------------------------------------------
-- Calculation Group: 'Monthly Averages relative to Current Month'
------------------------------------------------------------------
Last 12 Months = 
VAR ReferenceDate = EOMONTH ( TODAY ( ), 0 )
VAR NumMonths = 12
RETURN
    CALCULATE (
        AVERAGEX (
            VALUES ( 'Date'[Year Month] ),
            SELECTEDMEASURE ( )
        ),
        DATESINPERIOD ( 'Date'[Date], ReferenceDate, -NumMonths, MONTH )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;------------------------------------------------------------------
-- Calculation Group: 'Monthly Averages relative to Filtered Date'
------------------------------------------------------------------
Last 12 Months = 
VAR ReferenceDate = MAX ( 'Date'[Date] )
VAR NumMonths = 12
RETURN
    CALCULATE (
        AVERAGEX (
            VALUES ( 'Date'[Year Month] ),
            SELECTEDMEASURE ( )
        ),
        DATESINPERIOD ( 'Date'[Date], ReferenceDate, -NumMonths, MONTH )
    )&lt;/LI-CODE&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;Are you able to get something similar working?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 03:51:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4745925#M181736</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-06-27T03:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Matrix that has 3,6,12 month averages of measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4746622#M181777</link>
      <description>&lt;P&gt;This works perfect thank you for all you help!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 13:29:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-Matrix-that-has-3-6-12-month-averages-of-measures/m-p/4746622#M181777</guid>
      <dc:creator>lovekheart</dc:creator>
      <dc:date>2025-06-27T13:29:58Z</dc:date>
    </item>
  </channel>
</rss>

