<?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: Issue with DAX Measures for Forecast Model in Power BI in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3770733#M147266</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="362042" data-lia-user-login="T_JF2022" class="lia-mention lia-mention-user"&gt;T_JF2022&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Power BI, if the row totals for a matrix are incorrect, this is usually because of the way the metric is calculated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To ensure that the row totals are displayed correctly, you can try the following steps:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Ensure that your metrics are calculated correctly in the detail rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I notice that you are using sum for your summation, perhaps you could consider using sumx.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Use the SUMX function to wrap your metric value on top of your metric value to make sure that both the detail rows and the total rows are correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Mar 2024 08:24:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-18T08:24:33Z</dc:date>
    <item>
      <title>Issue with DAX Measures for Forecast Model in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3769402#M147216</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I’m currently building a forecast model in Power BI that relies on multiple fact tables. The model is designed to display the entire year 2024, broken down by individual months (Jan-Dec). I’m using four different tables for this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Monthending (the result of the month-end closing)&lt;/LI&gt;&lt;LI&gt;Orders (all open orders)&lt;/LI&gt;&lt;LI&gt;Invoices (all invoiced orders of the current month)&lt;/LI&gt;&lt;LI&gt;Prod-FC (Production Forecast)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The 2024 timeline should be filled with the revenue from Monthending for all months as long as this dataset contains data. The following month after the last dataset should determine the cumulative value of Orders &amp;amp; Invoices for the current month. The subsequent months should be filled with the Prod-FC.&lt;/P&gt;&lt;P&gt;I’ve divided this calculation into two measures:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Determining the current revenue&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="markup"&gt;Rev-AC 4 = 
VAR CurrentPeriod = MONTH(MAX('invoices'[Invoice DATE]))
VAR Customer = SELECTEDVALUE('CustomerGroups'[CustomerSTAT]) 
VAR OrdersREV = CALCULATE(SUM('orders'[Amount]), ALL('Orders'), 'Orders'[OMonth] &amp;lt;= CurrentPeriod, 'orders'[CustomerSTAT] = Customer)
VAR InvoicesREV = CALCULATE(SUM('invoices'[Amount]), ALL('Invoices'), 'invoices'[IMonth] = CurrentPeriod, 'invoices'[CustomerSTAT] = Customer)
VAR TotalOrderREV = CALCULATE(SUM('orders'[Amount]), ALL('Orders'), 'Orders'[OMonth] &amp;lt;= CurrentPeriod)
VAR TotalInvoicesREV = CALCULATE(SUM('invoices'[Amount]), ALL('Invoices'), 'invoices'[IMonth] = CurrentPeriod)
RETURN
IF(CurrentPeriod = 3, IF(HASONEVALUE('CustomerGroups'[CustomerSTAT]), OrdersREV + InvoicesREV, TotalOrderREV + TotalInvoicesREV), BLANK())&lt;/LI-CODE&gt;&lt;OL&gt;&lt;LI&gt;The total revenue for the whole year with distribution on the timeline&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="markup"&gt;FC_REV 3 = 
VAR ME_REV = CALCULATE(SUM('monthending'[Amount]))
VAR RevAC = [Rev-AC 4]
VAR ProdFc_REV = CALCULATE(SUM('prod-fc'[Amount]))
RETURN
IF(
    NOT(ISBLANK(RevAC)), RevAC,
    IF(
        NOT(ISBLANK(ME_REV)), ME_REV,
        IF(
            NOT(ISBLANK(ProdFc_REV)), ProdFc_REV,
            BLANK()
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;I’m encountering a problem with the second measure (maybe 1st measure also). While the distribution to the individual months in this model works without issues (although it’s not dynamically determined and requires a clear definition of the current month by me), and the column subtotals are also correct, the row total is incorrect. In the row total, the result of the current month is displayed instead of the sum of all individual sums of the months.&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;Perhaps my DAX approach is too complicated, but I hope someone can shed some light on this issue. Attached you will find the data basis and the PBIX file.&lt;/P&gt;&lt;P&gt;&lt;A title="Google-Drive- FC DATA" href="https://drive.google.com/drive/folders/1v16In4_XjfpwSmhnPqd_mKokiDAO-NWB?usp=drive_link" target="_self"&gt;https://drive.google.com/drive/folders/1v16In4_XjfpwSmhnPqd_mKokiDAO-NWB?usp=drive_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 17 Mar 2024 14:17:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3769402#M147216</guid>
      <dc:creator>T_JF2022</dc:creator>
      <dc:date>2024-03-17T14:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with DAX Measures for Forecast Model in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3770733#M147266</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="362042" data-lia-user-login="T_JF2022" class="lia-mention lia-mention-user"&gt;T_JF2022&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Power BI, if the row totals for a matrix are incorrect, this is usually because of the way the metric is calculated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To ensure that the row totals are displayed correctly, you can try the following steps:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Ensure that your metrics are calculated correctly in the detail rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I notice that you are using sum for your summation, perhaps you could consider using sumx.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Use the SUMX function to wrap your metric value on top of your metric value to make sure that both the detail rows and the total rows are correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 08:24:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3770733#M147266</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-18T08:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with DAX Measures for Forecast Model in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3771624#M147347</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="362042" data-lia-user-login="T_JF2022" class="lia-mention lia-mention-user"&gt;T_JF2022&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code should work.&lt;/P&gt;&lt;P&gt;Gobal2 =&lt;BR /&gt;VAR MaxDateActuals =&lt;BR /&gt;CALCULATE ( MAX ( monthending[Finished Period] ), REMOVEFILTERS () )&lt;BR /&gt;VAR moisAct =&lt;BR /&gt;MONTH ( MaxDateActuals )&lt;BR /&gt;VAR act =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;monthending,&lt;BR /&gt;monthending[Amount],&lt;BR /&gt;monthending[CustomerSTAT],&lt;BR /&gt;monthending[Finished Period],&lt;BR /&gt;"Origin", "Actuals"&lt;BR /&gt;)&lt;BR /&gt;VAR Inv =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;invoices,&lt;BR /&gt;invoices[Amount],&lt;BR /&gt;invoices[CustomerSTAT],&lt;BR /&gt;invoices[Invoice DATE],&lt;BR /&gt;"Origin", "Invoice"&lt;BR /&gt;)&lt;BR /&gt;VAR Ord =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;orders,&lt;BR /&gt;orders[Amount],&lt;BR /&gt;orders[CustomerSTAT],&lt;BR /&gt;orders[Planned DATE],&lt;BR /&gt;"Origin", "Invoice"&lt;BR /&gt;)&lt;BR /&gt;VAR Frcst =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;'prod-fc',&lt;BR /&gt;'prod-fc'[Amount],&lt;BR /&gt;'prod-fc'[CustomerSTAT],&lt;BR /&gt;'prod-fc'[Production Period],&lt;BR /&gt;"Origin", "Forecast"&lt;BR /&gt;)&lt;BR /&gt;VAR base1 =&lt;BR /&gt;UNION ( act, Inv )&lt;BR /&gt;VAR base2 =&lt;BR /&gt;UNION ( Ord, Frcst )&lt;BR /&gt;VAR Endingbase =&lt;BR /&gt;FILTER (&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;UNION ( base1, base2 ),&lt;BR /&gt;"MoisFinal",&lt;BR /&gt;IF (&lt;BR /&gt;AND ( MONTH ( monthending[Finished Period] ) &amp;lt;= moisAct, [Origin] = "Actuals" ),&lt;BR /&gt;MONTH ( monthending[Finished Period] ),&lt;BR /&gt;IF (&lt;BR /&gt;AND (&lt;BR /&gt;MONTH ( monthending[Finished Period] ) &amp;lt;= moisAct + 1,&lt;BR /&gt;[Origin] = "Invoice"&lt;BR /&gt;),&lt;BR /&gt;moisAct + 1,&lt;BR /&gt;IF (&lt;BR /&gt;AND (&lt;BR /&gt;MONTH ( monthending[Finished Period] ) &amp;gt;= moisAct + 2,&lt;BR /&gt;[Origin] = "Forecast"&lt;BR /&gt;),&lt;BR /&gt;MONTH ( monthending[Finished Period] ),&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;[MoisFinal] &amp;lt;&amp;gt; 0&lt;BR /&gt;)&lt;BR /&gt;VAR res2 =&lt;BR /&gt;SUMX ( Endingbase, [Amount] )&lt;BR /&gt;RETURN&lt;BR /&gt;res2&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 12:49:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3771624#M147347</guid>
      <dc:creator>JamesFR06</dc:creator>
      <dc:date>2024-03-18T12:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with DAX Measures for Forecast Model in Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3775703#M147549</link>
      <description>&lt;P&gt;Insane, it worked &lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 14:42:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-DAX-Measures-for-Forecast-Model-in-Power-BI/m-p/3775703#M147549</guid>
      <dc:creator>T_JF2022</dc:creator>
      <dc:date>2024-03-19T14:42:30Z</dc:date>
    </item>
  </channel>
</rss>

