<?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: 3 full months trailing graph in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4069152#M161549</link>
    <description>&lt;P&gt;Please go through this article&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2024 12:37:18 GMT</pubDate>
    <dc:creator>SachinNandanwar</dc:creator>
    <dc:date>2024-07-30T12:37:18Z</dc:date>
    <item>
      <title>3 full months trailing graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4069003#M161543</link>
      <description>&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please assist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My stakeholders are excel lovers and want a view as below (dummy excel data).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If they select a month in the slicer, then the graph must show&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the trailing 3 months of &lt;U&gt;&lt;EM&gt;sales&lt;/EM&gt;&lt;/U&gt; and &lt;EM&gt;&lt;U&gt;previous year sales&lt;/U&gt;&lt;/EM&gt;;&lt;/LI&gt;&lt;LI&gt;and then the &lt;U&gt;&lt;EM&gt;forecast&lt;/EM&gt;&lt;/U&gt; and &lt;EM&gt;&lt;U&gt;target&lt;/U&gt;&lt;/EM&gt; for that selected slicer month.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My attempts:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i created a seperate date table, that does not have a relationship to the other tables and then referenced it in the measure below to get the sales for the selected slicer date (and 3 months trailing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;MonthSales =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;CurrentDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Previous Date'&lt;/SPAN&gt;&lt;SPAN&gt;[EndofMonth]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;SelectedDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;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&gt;&amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;CurrentDate&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Result&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Problem 1: &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However practically i get more or sometimes less than 3 exact months, as seen in the powerbi graph below. I believe this is because of the number of days in a month, but i want the full 3 months (selected month and 2 prior; if the selected month is not complete yet, then still only show me the incomplete month and 2 full months prior.)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Problem 2:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How can I get the previous year sales, this calculation does not work for previous year?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 10:43:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4069003#M161543</guid>
      <dc:creator>SammyNed</dc:creator>
      <dc:date>2024-07-30T10:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: 3 full months trailing graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4069152#M161549</link>
      <description>&lt;P&gt;Please go through this article&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 12:37:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4069152#M161549</guid>
      <dc:creator>SachinNandanwar</dc:creator>
      <dc:date>2024-07-30T12:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: 3 full months trailing graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4070433#M161597</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="312920" data-lia-user-login="SammyNed" class="lia-mention lia-mention-user"&gt;SammyNed&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="777262" data-lia-user-login="SachinNandanwar" class="lia-mention lia-mention-user"&gt;SachinNandanwar&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use these sample data to demonstrate.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. create a calculation table. And adjust the date format.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table =
DISTINCT(‘financials’[Date])&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. create MEASURE.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
VAR _cur_mon =
EOMONTH ( SELECTEDVALUE ( ‘Table’[Date] ), 0 )
VAR _3_mon =
EOMONTH ( SELECTEDVALUE ( ‘Table’[Date] ), -3 ) + 1
RETURN
IF (
MAX ( ‘financials’[Date] ) &amp;lt;= _cur_mon
&amp;amp;&amp;amp; MAX ( ‘financials’[Date] ) &amp;gt;= _3_mon,
1
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;3. Filter the data in the bar chart where MEASURE is 1.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 05:48:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4070433#M161597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-31T05:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: 3 full months trailing graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4081183#M162006</link>
      <description>&lt;P&gt;thank you&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;. This really helped. I think my issue was with the date table (it was in days and not months)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 12:06:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/3-full-months-trailing-graph/m-p/4081183#M162006</guid>
      <dc:creator>SammyNed</dc:creator>
      <dc:date>2024-08-05T12:06:15Z</dc:date>
    </item>
  </channel>
</rss>

