<?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: Showing monthly actual data and forecast data in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2914881#M95400</link>
    <description>&lt;P&gt;Thank you very much, that has worked perfectly!!&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 10:08:46 GMT</pubDate>
    <dc:creator>metcala</dc:creator>
    <dc:date>2022-11-18T10:08:46Z</dc:date>
    <item>
      <title>Showing monthly actual data and forecast data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2903282#M94622</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem that I am struggling with and can see similar topics that have been resolved but not exactly the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone can point me in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Displaying current financial year month actuals up until current month and then forecast for future months&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data structure&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Date table&lt;BR /&gt;Date&lt;BR /&gt;Calendar Year&lt;BR /&gt;Month Name&lt;BR /&gt;Month Number&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;Employees&lt;BR /&gt;Employee ID&lt;BR /&gt;Title&lt;BR /&gt;Name&lt;BR /&gt;Start Date&lt;BR /&gt;End Date&lt;BR /&gt;...&lt;BR /&gt;EmployeeCosts (Measure)&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EmployeeCosts =
CALCULATE( SUM( 'Employees'[Monthly Costs]),
   FILTER( 'Employees', 'Employees'[Start Date] &amp;lt;= MAX( 'Date'[Date]) &amp;amp;&amp;amp; ( ISBLANK( 'Employees'[End Date]) || 'Employees'[End Date] &amp;gt; MAX ('Date'[Date]))), ('Employees'[Title)))​&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Payroll Actuals&lt;BR /&gt;...&lt;BR /&gt;Payroll End Date&lt;BR /&gt;Employee ID&lt;BR /&gt;Monthly Cost&lt;BR /&gt;PayrollCosts (Measure)&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PayrollCosts =
CALCULATE( SUM( 'Payroll'[Actual],
   FILTER( 'Employees', 'Employees'[Start Date] &amp;lt;= MAX( 'Date'[Date]) &amp;amp;&amp;amp; (ISBLANK('Employees'[End Date]) || 'Employees'[End Date] &amp;gt; MAX( 'Date'[Date]))), ('Employees'[Title]),
USERELATIONSHIP( 'Date'[Date], Payroll[Payroll End Date]))​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current attempt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So I have tried resolve this with a measure on Payroll as follows but it only is showing the actuals&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ActualForecasts =
IF( SELECTEDVALUE( 'Payroll'[Payroll End Date] &amp;lt;= MONTH( TODAY()),
'Payroll'[PayrollCosts],'Employees'[EmployeeCosts])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help/guidance would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 09:35:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2903282#M94622</guid>
      <dc:creator>metcala</dc:creator>
      <dc:date>2022-11-14T09:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Showing monthly actual data and forecast data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2905018#M94746</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="465614" data-lia-user-login="metcala" class="lia-mention lia-mention-user"&gt;metcala&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you provide &lt;/SPAN&gt;&lt;SPAN&gt;s&lt;/SPAN&gt;&lt;SPAN&gt;ample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 01:42:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2905018#M94746</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-11-15T01:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Showing monthly actual data and forecast data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2905799#M94804</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi there thanks for getting back, hopefully this makes a little bit more sense....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Employee table&lt;/U&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;U&gt;Payroll table&lt;/U&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;U&gt;Expected result&lt;/U&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;I have tested the logic for the measures in my original message which appears to be correct. I just want to check if there is actual payroll data and if so use that otherwise revert to the total in the employee table for the expected monthly cost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for not being clear in my initial message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 12:37:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2905799#M94804</guid>
      <dc:creator>metcala</dc:creator>
      <dc:date>2022-11-15T12:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Showing monthly actual data and forecast data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2914747#M95389</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="465614" data-lia-user-login="metcala" class="lia-mention lia-mention-user"&gt;metcala&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try the following methods&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Add a new month-end date table to make the column of the matrix.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _actual =
    CALCULATE (
        SUM ( Payroll[Monthly Actual Cost] ),
        FILTER (
            ALL ( Payroll ),
            [Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
                &amp;amp;&amp;amp; [Payroll End Date] = SELECTEDVALUE ( 'Date'[Month end] )
        )
    )
VAR _forecast =
    CALCULATE (
        SUM ( Employee[Expected Monthly Salary] ),
        FILTER (
            ALL ( Employee ),
            [Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
        )
    )
RETURN
    IF ( _actual = BLANK (), _forecast, _actual )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 09:22:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2914747#M95389</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-11-18T09:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Showing monthly actual data and forecast data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2914881#M95400</link>
      <description>&lt;P&gt;Thank you very much, that has worked perfectly!!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 10:08:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Showing-monthly-actual-data-and-forecast-data/m-p/2914881#M95400</guid>
      <dc:creator>metcala</dc:creator>
      <dc:date>2022-11-18T10:08:46Z</dc:date>
    </item>
  </channel>
</rss>

