<?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: Monthly Comparison with yearly average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Monthly-Comparison-with-yearly-average/m-p/2556233#M72570</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING&amp;gt;NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.&lt;/P&gt;&lt;P&gt;Let]s say you have a measure for Total Charges:&lt;/P&gt;&lt;P&gt;Total Charges = SUM(&lt;SPAN&gt;'Charge Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Total Charges])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then you use this pattern with DATEADD function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Charges last 6 months =&amp;nbsp;CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))&lt;BR /&gt;Last 12 Month Charges =&amp;nbsp;CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this helps:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Date Table cose next:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[&amp;nbsp;Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2022 19:15:20 GMT</pubDate>
    <dc:creator>Whitewater100</dc:creator>
    <dc:date>2022-06-02T19:15:20Z</dc:date>
    <item>
      <title>Monthly Comparison with yearly average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Monthly-Comparison-with-yearly-average/m-p/2556212#M72568</link>
      <description>&lt;P&gt;I need to create a table or matrix that breaks the data into 4 columns: this month, last month, average of last 6 months, and avg of last 12 months.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the best way to go about this? I tried grouping the data, but the groups can't overlap (ie 4/20/22 would need to be included in last month, last 6 months, and last 12 months. I also tried this formula&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Last month = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Charge Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Total Charges]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;dateadd&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Charge Data'[Date Satisfied]&lt;/SPAN&gt;&lt;SPAN&gt;,-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But adding that measure to the matrix values just includes it as a new row... If that makes any sense?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any and all help is appreciated!&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Jun 2022 18:57:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Monthly-Comparison-with-yearly-average/m-p/2556212#M72568</guid>
      <dc:creator>madisonkelly</dc:creator>
      <dc:date>2022-06-02T18:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Monthly Comparison with yearly average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Monthly-Comparison-with-yearly-average/m-p/2556233#M72570</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING&amp;gt;NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.&lt;/P&gt;&lt;P&gt;Let]s say you have a measure for Total Charges:&lt;/P&gt;&lt;P&gt;Total Charges = SUM(&lt;SPAN&gt;'Charge Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Total Charges])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then you use this pattern with DATEADD function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Charges last 6 months =&amp;nbsp;CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))&lt;BR /&gt;Last 12 Month Charges =&amp;nbsp;CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this helps:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Date Table cose next:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[&amp;nbsp;Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 19:15:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Monthly-Comparison-with-yearly-average/m-p/2556233#M72570</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-06-02T19:15:20Z</dc:date>
    </item>
  </channel>
</rss>

