<?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: Compound results up depending on date hierarchy in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1261686#M21015</link>
    <description>&lt;P&gt;It is similar but unfortunately not the same as the IRR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've had a look at the maths, simplified the expression and created a DAX expression which calculates the returns for each of the 12 previous months and then multiplies them together to give the annual compound return for that month. It isn't pretty nor quick but it gives me the answer I am looking for (at a cost of 500ms per calculation!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX as follows:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;Total Property Return = &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Calculate each month's TPR&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR0 = CALCULATE((SUM('Forecast returns FINAL'[Net Value END])+SUM('Forecast returns FINAL'[ Net Operating Income]))/(SUM('Forecast returns FINAL'[Net Value START])-SUM('Forecast returns FINAL'[ Total Leasing &amp;amp; Capital Costs (in period)])))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR1 = CALCULATE((SUM('Forecast returns FINAL'[Net Value END])+SUM('Forecast returns FINAL'[ Net Operating Income]))/(SUM('Forecast returns FINAL'[Net Value START])-SUM('Forecast returns FINAL'[ Total Leasing &amp;amp; Capital Costs (in period)])),DATEADD(Dates[Date],-1,MONTH))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;....The above TPR1 expression is repeated all the way up to TPR11 for each month with -1 added to each month&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Calculate compounded annual TPR&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR = ( TPR0 * TPR1 * TPR2 * TPR3 * TPR4 * TPR5 * TPR6 * TPR7 * TPR8 * TPR9 * TPR10 * TPR11 ) -1&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;Return&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Eliminate results in first year where less than 12 months and on days between data periods&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;IF(TPR=-1,"",TPR)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm now interested in optimising this query. If the individual TPR queries could be improved then there is a x12 saving to be made! Any thoughts?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2020 10:12:52 GMT</pubDate>
    <dc:creator>FrankProperty</dc:creator>
    <dc:date>2020-07-30T10:12:52Z</dc:date>
    <item>
      <title>Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1253222#M20675</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dashboard where the user selects a combination of assets (a list of several hundred options) and the returns over time are shown on a line chart. The user can then drill down across a date hierarchy to see annual, quarterly and monthly returns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data for the returns calculation is on a monthly basis and the returns are calculated from the underlying data components (ie. numerator and denominator are measures which are calculated depending on the selection and time period) for accuracy rather than a weighted average of the returns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally I want Power BI to calculate the monthly return and then show higher hierarchy levels as a compound of the monthly. The steps would therefore be as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;User selects which assets they want using a slicer&lt;/LI&gt;&lt;LI&gt;Power BI calculates the monthly returns&lt;/LI&gt;&lt;LI&gt;Power BI then calculates the compounded returns to display at quarterly/annual level.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My first thought was to put the calculated monthly returns into a table and then compound and display those results in the chart but I don't think the tables are that clever in Power BI (I could be mistaken). Is there a clever way to do the above in DAX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset is sensitive but I can whip together a really simple example if it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 16:32:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1253222#M20675</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-27T16:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1255135#M20726</link>
      <description>&lt;P&gt;Here is an example dataset with workings:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1ncxSvZhOn23V6IWsmD_oFyZ9xzx1nDVf/view?usp=sharing" target="_blank" rel="noopener"&gt;Dataset&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 09:09:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1255135#M20726</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-28T09:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1259154#M20887</link>
      <description>Hi there. Sadly, due to my company's policy I can't even view the file you attached. Could you please paste some screenshots for me to see what it is you want? When you say "returns", do you mean the IRR - the internal rate of return?</description>
      <pubDate>Wed, 29 Jul 2020 12:01:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1259154#M20887</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-29T12:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1261686#M21015</link>
      <description>&lt;P&gt;It is similar but unfortunately not the same as the IRR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've had a look at the maths, simplified the expression and created a DAX expression which calculates the returns for each of the 12 previous months and then multiplies them together to give the annual compound return for that month. It isn't pretty nor quick but it gives me the answer I am looking for (at a cost of 500ms per calculation!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX as follows:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;Total Property Return = &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Calculate each month's TPR&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR0 = CALCULATE((SUM('Forecast returns FINAL'[Net Value END])+SUM('Forecast returns FINAL'[ Net Operating Income]))/(SUM('Forecast returns FINAL'[Net Value START])-SUM('Forecast returns FINAL'[ Total Leasing &amp;amp; Capital Costs (in period)])))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR1 = CALCULATE((SUM('Forecast returns FINAL'[Net Value END])+SUM('Forecast returns FINAL'[ Net Operating Income]))/(SUM('Forecast returns FINAL'[Net Value START])-SUM('Forecast returns FINAL'[ Total Leasing &amp;amp; Capital Costs (in period)])),DATEADD(Dates[Date],-1,MONTH))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;....The above TPR1 expression is repeated all the way up to TPR11 for each month with -1 added to each month&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Calculate compounded annual TPR&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;VAR TPR = ( TPR0 * TPR1 * TPR2 * TPR3 * TPR4 * TPR5 * TPR6 * TPR7 * TPR8 * TPR9 * TPR10 * TPR11 ) -1&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;Return&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#008000"&gt;&lt;EM&gt;//Eliminate results in first year where less than 12 months and on days between data periods&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;IF(TPR=-1,"",TPR)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm now interested in optimising this query. If the individual TPR queries could be improved then there is a x12 saving to be made! Any thoughts?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 10:12:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1261686#M21015</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-30T10:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1261785#M21018</link>
      <description>This is a very naïve way of calculation. Instead of this, you should use the GENERATE function or an iteration over a suitable chosen column in a table. Probably over months.</description>
      <pubDate>Thu, 30 Jul 2020 10:42:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1261785#M21018</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T10:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1262993#M21087</link>
      <description>&lt;P&gt;I agree it is however I have fairly limited knowledge of the back end calculations. I've looked at the GENERATE function but not sure how it would work in this instance. Are you able to help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tackled the problem in another way by creating an index (in a benchmark context rather than a power query context). The code provides greater flexibility for my analysis however there are huge inefficiencies and it increases the time to calculate from 500ms to 3.5s.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The new code has two measures. The first multiplies all the % returns from the previous periods together to show an index value as at that date. The second then compares the index value today against a year ago. The problem with the &lt;EM&gt;TPR Index&lt;/EM&gt; measure is that it ideally should take the index value in the last period and multiply that by the return in this current period. However I think it is calculating the returns for each period when calculating the index at each period (turning a few hundred calculations into many thousands). Is there a more efficient way using GENERATE?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;&lt;STRONG&gt;TPR Index&lt;/STRONG&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#008000"&gt;&lt;SPAN&gt;//Filter dates for everything before and including the current period&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;VAR _AllPreviousPeriods = FILTER(ALL('Dates'),'Dates'[Date] &amp;lt;= MAX('Dates'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#008000"&gt;&lt;SPAN&gt;//Return the product of the Returns for all those dates - this creates the index benchmark&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;PRODUCTX( _AllPreviousPeriods, [TPR] )*100&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;TPRinYear&lt;/STRONG&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;DIV&gt;&lt;FONT color="#008000"&gt;&lt;SPAN&gt;//Takes the index today and compares against the index 1 year ago&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[TPR Index]/CALCULATE([TPR Index],SAMEPERIODLASTYEAR(Dates[Date]))-1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Jul 2020 17:57:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1262993#M21087</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-30T17:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264353#M21137</link>
      <description>&lt;P&gt;For your TPR calculation use the function GENERATESERIES( 0, 11, 1 ). This will produce the values ([Value] field) that you'll then stick into DATEADD( Dates[Date], -[Value], MONTH ). By doing this you'll get rid of the manual repetitions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you should never, ever do things like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;F(TPR=-1,"",TPR)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measures &lt;SPAN&gt;&lt;SPAN&gt;should return &lt;STRONG&gt;only one data type&lt;/STRONG&gt; (and BLANK if needed). The last bit should be IF( TPR &amp;lt;&amp;gt; -1, TPR ).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 08:57:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264353#M21137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-31T08:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264449#M21142</link>
      <description>&lt;P&gt;Thanks Daxer. That tidies up the original code but I am still not satisfied that it is the best way of calculating.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked into GENERATE using the below code. The line graph shows the return for each period so I think the generate function is working. However, it doesn't seem to be considering previous periods in the PRODUCTX calculation so it isn't creating the index I want. I tried using the ALL function (as I did in my previous code) but it cannot be used for a table expression. Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;TPR 2 = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#008000"&gt;//Define the dates for calculation and create a table which has the return for each period. Intention is to use this table for the subsequent calculations.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR BaseCalendar =&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CALENDAR ( MIN('Forecast returns FINAL'[Date]), max('Forecast returns FINAL'[Date]))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR TPRtable =&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;GENERATEALL (&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-120px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;BaseCalendar,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-120px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR TPRinPeriod = SUM('Forecast returns FINAL'[Numerator])/sum('Forecast returns FINAL'[Denominator])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-120px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;RETURN ROW (&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-120px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;"TPRinPeriod", TPRinPeriod&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-120px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;EM&gt;&lt;FONT color="#008000"&gt;//Filter the previously generated table to show all dates up to that point and then multiply the return in each period to create the index benchmark.&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;PRODUCTX ( TPRtable , [TPRinPeriod] * 100) ,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;FILTER ( TPRtable , [Date] &amp;lt; MAX([Date])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:33:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264449#M21142</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-31T09:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264466#M21143</link>
      <description>&lt;P&gt;Light blue shows the correct index (stepped) result using my earlier method. The dark blue shows the latest code which is just returning the TPR in that period (rather than compounding up).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:36:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264466#M21143</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-31T09:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264519#M21145</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// hidden measures:
[_NetValueEnd] =
	SUM( 'Forecast returns FINAL'[Net Value END] )
[_NetOperatingIncome] =
	SUM( 'Forecast returns FINAL'[ Net Operating Income] )
[_NetValueStart] =
	SUM( 'Forecast returns FINAL'[Net Value START] )
[_TotalLeasingCapitalCost] =
	SUM( 'Forecast returns FINAL'[ Total Leasing &amp;amp; Capital Costs (in period)] )


[TPR] =
var __rawFormula =
	PRODUCTX(
	
		GENERATESERIES( 0, 11, 1 ),
		
		var __monthsBack = [Value]
		RETURN
		CALCULATE(
		    DIVIDE(
		        [_NetValueEnd] + [_NetOperatingIncome],
		    	[_NetValueStart] - [_TotalLeasingCapitalCost]
		    ),
		    DATEADD(
		    	// Dates must be marked as the Date table
		        Dates[Date],
		        -(__monthsBack),
		        MONTH
		    )
		)
	)
var __finalFormula = __rawFormula - 1
return
	IF( __finalFormula &amp;lt;&amp;gt; -1, __finalFormula )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:55:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264519#M21145</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-31T09:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compound results up depending on date hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264558#M21146</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- that code seems to half the computation time and is much better!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've accepted your last post as the solution. Thanks for your help getting here (even if it felt like banging your head against the wall at times!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:16:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compound-results-up-depending-on-date-hierarchy/m-p/1264558#M21146</guid>
      <dc:creator>FrankProperty</dc:creator>
      <dc:date>2020-07-31T10:16:17Z</dc:date>
    </item>
  </channel>
</rss>

