<?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: Forecasting current month based on previous month - measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4291028#M170285</link>
    <description>&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;Simple approach.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 12:28:23 GMT</pubDate>
    <dc:creator>raqueiros</dc:creator>
    <dc:date>2024-11-19T12:28:23Z</dc:date>
    <item>
      <title>Forecasting current month based on previous month - measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4284519#M170047</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;I want to create a report/table that shows the following information:&lt;/P&gt;&lt;P&gt;. Country&lt;BR /&gt;. qty sales (month to date) - measure already exists&lt;BR /&gt;. qty sales last month (total month) - measure already exists&lt;/P&gt;&lt;P&gt;. qty sales CM Total (forecast current month based on previous month) - need to create&lt;/P&gt;&lt;P&gt;. variance qty sales (month to date) - need to create&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example below:&amp;nbsp; Date = 14 Nov&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;MTD&lt;/TD&gt;&lt;TD&gt;October (total)&lt;/TD&gt;&lt;TD&gt;Forecast November (total)&lt;/TD&gt;&lt;TD&gt;var CM/LM (MTD)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;United States&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;TD&gt;1714&lt;/TD&gt;&lt;TD&gt;18%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;France&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;450&lt;/TD&gt;&lt;TD&gt;471&lt;/TD&gt;&lt;TD&gt;8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Germany&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;429&lt;/TD&gt;&lt;TD&gt;-11%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Spain&lt;/TD&gt;&lt;TD&gt;175&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;375&lt;/TD&gt;&lt;TD&gt;-3%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:20:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4284519#M170047</guid>
      <dc:creator>apple43</dc:creator>
      <dc:date>2024-11-14T18:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Forecasting current month based on previous month - measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4284955#M170073</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="414584" data-lia-user-login="apple43" class="lia-mention lia-mention-user"&gt;apple43&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create measures with the following DAX:&lt;/P&gt;
&lt;P&gt;[MTD] and [October(total)] are measures you've already created.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Forecast November (total) = 
VAR DaysInCurrentMonth = DAY(EOMONTH(TODAY(), 0))
VAR DaysElapsed = DAY(TODAY())
VAR SalesPerDay = [MTD] / DaysElapsed
RETURN
SalesPerDay * DaysInCurrentMonth&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;CM/LM (MTD) = 
VAR DaysInLastMonth = DAY(EOMONTH(TODAY(), -1))
VAR DaysElapsed = DAY(TODAY())
VAR LM_MTD = [October (total)] * DaysElapsed / DaysInLastMonth
RETURN
[MTD] / LM_MTD - 1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(Since the TODAY() is used in Measure, the result are dynamic and the current screenshot result in 11/15.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Jarvis Tang&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt; &lt;/EM&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 02:07:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4284955#M170073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-15T02:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Forecasting current month based on previous month - measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4285162#M170085</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="414584" data-lia-user-login="apple43" class="lia-mention lia-mention-user"&gt;apple43&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To create a report or table like this, you’ll need to add some calculations in your dataset or BI tool. Here’s how to approach creating each measure based on your example. I’ll walk you through the formulas for:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Qty Sales CM Total (Forecast Current Month)&lt;/STRONG&gt;: Using October as a basis, this forecast assumes that the rest of the month will perform similarly to October.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Variance Qty Sales (MTD)&lt;/STRONG&gt;: This measures the Month-to-Date (MTD) percentage difference compared to the Last Month’s MTD.&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;H3&gt;1. &lt;STRONG&gt;Qty Sales CM Total (Forecast for Current Month)&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;To create this forecast, you want to estimate the total sales for November based on the sales of October. A simple way to forecast is:&lt;/P&gt;&lt;P&gt;For example, if the current date is November 14th:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Days Elapsed: 14&lt;/LI&gt;&lt;LI&gt;Total Days in Month: 30&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In DAX (for Power BI), you could write this formula as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Forecast CM Total = 
    DIVIDE([MTD Sales], DAY(TODAY())) * DAY(EOMONTH(TODAY(), 0))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula takes the current Month-to-Date (MTD) sales, divides by the current day in the month to get an average per day, then multiplies by the total days in November (using EOMONTH).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;2. &lt;STRONG&gt;Variance Qty Sales (MTD)&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;The MTD variance compares the current MTD sales against the previous month’s MTD sales to show percentage growth or decline.&lt;/P&gt;&lt;P&gt;In DAX, assuming you already have an MTD measure for last month, this would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Variance Qty Sales (MTD) = 
    DIVIDE([MTD Sales] - [MTD Sales Last Month], [MTD Sales Last Month], 0) * 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here’s a breakdown of what each column would contain based on your description:&lt;/P&gt;&lt;P&gt;Country Qty Sales MTD (November) Qty Sales Last Month (October Total) Forecast CM Total (November) Var CM/LM (MTD)&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;United States&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;TD&gt;1714&lt;/TD&gt;&lt;TD&gt;18%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;France&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;450&lt;/TD&gt;&lt;TD&gt;471&lt;/TD&gt;&lt;TD&gt;8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Germany&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;429&lt;/TD&gt;&lt;TD&gt;-11%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Spain&lt;/TD&gt;&lt;TD&gt;175&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;375&lt;/TD&gt;&lt;TD&gt;-3%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Each of these columns would use the formulas provided to dynamically update as MTD sales and date changes. You can then use these measures in your table visual for a dynamic view of current sales trends and forecasted totals for the month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;YouTube&lt;/STRONG&gt;: &lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_blank" rel="noopener"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 04:41:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4285162#M170085</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-11-15T04:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Forecasting current month based on previous month - measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4291028#M170285</link>
      <description>&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;Simple approach.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 12:28:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4291028#M170285</guid>
      <dc:creator>raqueiros</dc:creator>
      <dc:date>2024-11-19T12:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Forecasting current month based on previous month - measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4291029#M170286</link>
      <description>&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also solution for my problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 12:29:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecasting-current-month-based-on-previous-month-measure/m-p/4291029#M170286</guid>
      <dc:creator>raqueiros</dc:creator>
      <dc:date>2024-11-19T12:29:09Z</dc:date>
    </item>
  </channel>
</rss>

