<?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: Forecast percentage from measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3429955#M130008</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="371558" data-lia-user-login="Solle" class="lia-mention lia-mention-user"&gt;Solle&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is called a semi recursive calculation which is not straight forward when using DAX.&lt;/P&gt;
&lt;P&gt;The attached file includes&amp;nbsp;proposed solutions for both "Days From Today" column and the "New Formula" measure. I have no data that would have made it possible to propose a solution for "Cumulative %" Measure&lt;/P&gt;
&lt;P&gt;Could not upload sceenshots as currently uploading pictures is not working.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Days From Today = 
VAR CurrentDate = 'Date'[Date]
VAR MaxDate = MAX ( 'Table'[Date] )
VAR Difference = DATEDIFF ( MaxDate, CurrentDate, DAY )
VAR WD = 'Date'[Working Day]
VAR Holidys = CALCULATETABLE ( VALUES ( 'Date'[Date] ), 'Date'[Working Day] = "False", ALL ( 'Date' ) )
VAR NWD = NETWORKDAYS ( MaxDate, CurrentDate, 1,Holidys )
VAR Result = 
    IF ( 
        WD = "True",
        SWITCH (
            Difference / ABS ( Difference ),
            -1, NWD + 1,
            1, NWD - 1,
            0
        )
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;New Formula = 
VAR RE = 0.15
VAR CurrentDaysFromToday = MAX ( 'Date'[Days From Today] )
VAR IsOneDay = HASONEVALUE ( 'Date'[Date] )
VAR NormalValue = [Cumulative %]
VAR LastValue = CALCULATE ( [Cumulative %], 'Date'[Days From Today] = 0 )
VAR FPeriod = 
    FILTER ( 
        ALL ( 'Date'[Days From Today] ), 
        'Date'[Days From Today] &amp;lt;&amp;gt; BLANK ( )
            &amp;amp;&amp;amp; 'Date'[Days From Today] &amp;gt; 0
            &amp;amp;&amp;amp; 'Date'[Days From Today] &amp;lt;= CurrentDaysFromToday
    )
VAR Result = PRODUCTX ( FPeriod, ( 1 + RE ) ^ 'Date'[Days From Today] )
RETURN
    IF ( IsOneDay, NormalValue + LastValue * Result )&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 14 Sep 2023 04:54:46 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-09-14T04:54:46Z</dc:date>
    <item>
      <title>Forecast percentage from measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3428972#M129977</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I am trying to create a forecast model, that will have a parameter, which holds the return on equity value, which can be changed dynamically for forecasting purposes.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The challenge is that I have a measure which is calculating the cumulative return (%) and then for the last value a formula should be applied to calculate a simple forecast based on the latest value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The formula used to forecast is [Latest value from measure] * (1+Return on Equity)^t&lt;BR /&gt;Please see the example from Excel as per below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Does anyone know how to solve this in PowerBI DAX? I have a data table containing both workdays and weekends however days from today should only count workdays.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let me know if anything else is required from me to solve this.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 15:45:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3428972#M129977</guid>
      <dc:creator>Solle</dc:creator>
      <dc:date>2023-09-13T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Forecast percentage from measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3429955#M130008</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="371558" data-lia-user-login="Solle" class="lia-mention lia-mention-user"&gt;Solle&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is called a semi recursive calculation which is not straight forward when using DAX.&lt;/P&gt;
&lt;P&gt;The attached file includes&amp;nbsp;proposed solutions for both "Days From Today" column and the "New Formula" measure. I have no data that would have made it possible to propose a solution for "Cumulative %" Measure&lt;/P&gt;
&lt;P&gt;Could not upload sceenshots as currently uploading pictures is not working.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Days From Today = 
VAR CurrentDate = 'Date'[Date]
VAR MaxDate = MAX ( 'Table'[Date] )
VAR Difference = DATEDIFF ( MaxDate, CurrentDate, DAY )
VAR WD = 'Date'[Working Day]
VAR Holidys = CALCULATETABLE ( VALUES ( 'Date'[Date] ), 'Date'[Working Day] = "False", ALL ( 'Date' ) )
VAR NWD = NETWORKDAYS ( MaxDate, CurrentDate, 1,Holidys )
VAR Result = 
    IF ( 
        WD = "True",
        SWITCH (
            Difference / ABS ( Difference ),
            -1, NWD + 1,
            1, NWD - 1,
            0
        )
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;New Formula = 
VAR RE = 0.15
VAR CurrentDaysFromToday = MAX ( 'Date'[Days From Today] )
VAR IsOneDay = HASONEVALUE ( 'Date'[Date] )
VAR NormalValue = [Cumulative %]
VAR LastValue = CALCULATE ( [Cumulative %], 'Date'[Days From Today] = 0 )
VAR FPeriod = 
    FILTER ( 
        ALL ( 'Date'[Days From Today] ), 
        'Date'[Days From Today] &amp;lt;&amp;gt; BLANK ( )
            &amp;amp;&amp;amp; 'Date'[Days From Today] &amp;gt; 0
            &amp;amp;&amp;amp; 'Date'[Days From Today] &amp;lt;= CurrentDaysFromToday
    )
VAR Result = PRODUCTX ( FPeriod, ( 1 + RE ) ^ 'Date'[Days From Today] )
RETURN
    IF ( IsOneDay, NormalValue + LastValue * Result )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Sep 2023 04:54:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3429955#M130008</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-09-14T04:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Forecast percentage from measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3430698#M130063</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Amazing work! I was struggeling a bit with how to structure the DAX calculation inparticular for the compounding interest part, so thank you for providing an example, I did manage to apply and modify your code to my needs.&amp;nbsp;Appreciate that your took your time to help me out on this issue!&lt;BR /&gt;&lt;BR /&gt;Have a nice day!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 10:22:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Forecast-percentage-from-measure/m-p/3430698#M130063</guid>
      <dc:creator>Solle</dc:creator>
      <dc:date>2023-09-14T10:22:25Z</dc:date>
    </item>
  </channel>
</rss>

