<?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: Calculating the SUM of a subset from a running total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499883#M69090</link>
    <description>&lt;P&gt;Absolutely GENIUS &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;. thank you so much for helping me with this one. It really had me stumped.&lt;/P&gt;</description>
    <pubDate>Sat, 07 May 2022 14:06:07 GMT</pubDate>
    <dc:creator>UBComma</dc:creator>
    <dc:date>2022-05-07T14:06:07Z</dc:date>
    <item>
      <title>Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2498807#M69026</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;Any thoughts on this one?&lt;/P&gt;&lt;P&gt;I am trying to write a measure that can be updated by parameter values. I had this working as a calculated table but I'm having trouble getting one of the measures to work. Essentially what I am trying to do is calculate the sum of a specific set of values in a running total. The set is defined by years (I need to go from the present year back 15 years in this case). Once I have that SUM I'm entering it into the PMT function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the measure I'm trying to fix........&lt;/P&gt;&lt;P&gt;Sum of Annual Values for past 15 years =&lt;/P&gt;&lt;P&gt;VAR Rate = .0275&lt;/P&gt;&lt;P&gt;VAR Periods = 15&lt;/P&gt;&lt;P&gt;VAR PeriodSum =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUMX (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALCULATETABLE (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADDCOLUMNS (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Running Total", [RT]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years[Year] &amp;lt;= SELECTEDVALUE ( Years[Year] ) &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years[Year] &amp;gt; SELECTEDVALUE ( Years[Year] ) - Periods&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Running Total]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PMT ( Rate, Periods, - PeriodSum )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above measure is placed in a visual, say a table, the first column is Years[Year], and then the measure would follow.&lt;/P&gt;&lt;P&gt;My Years table is this: Years = GENERATESERIES (2022 , 2022 + 50, 1 )&lt;/P&gt;&lt;P&gt;And the [RT] measure is a value that increments up each year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the measure I get the correct values for the first year, 2022, through 2037, and then (after 15years) it goes flat and returns the same value for the rest of the years. I'm guessing there's something wrong with my filter context of Years[Year] but I can't figure it out. If anyone can offer a suggestion, I will greatly appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Graphically, this is what I'm trying t do:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 13:50:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2498807#M69026</guid>
      <dc:creator>UBComma</dc:creator>
      <dc:date>2022-05-06T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499011#M69037</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="276221" data-lia-user-login="UBComma" class="lia-mention lia-mention-user"&gt;UBComma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you share a screenshot of your table visual including both measures [RT] and [&lt;SPAN&gt;Sum of Annual Values for past 15 years]. What is the code for [RT]?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 15:19:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499011#M69037</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-06T15:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499031#M69039</link>
      <description>&lt;P&gt;The SELECTEVALUE inside the CALCULATETABLE seems strange to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd try refactoring a bit:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Sum of Annual Values for past 15 years =
VAR Rate = .0275
VAR Periods = 15
VAR CurrYear = SELECTEDVALUE ( Years[Year] )
VAR YearRange =
    FILTER (
        ALL ( Years ),
        Years[Year] &amp;lt;= CurrYear &amp;amp;&amp;amp;
        Years[Year] &amp;gt; CurrYear - Periods
    )
VAR PeriodSum =
    SUMX (
        ADDCOLUMNS ( YearRange, "Running Total", [RT] ),
        [Running Total]
    )
RETURN
    PMT ( Rate, Periods, - PeriodSum )&lt;/LI-CODE&gt;
&lt;P&gt;I'm not sure this will do exactly what you want, but IMO, it's easier to debug if it doesn't.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 15:28:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499031#M69039</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-05-06T15:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499115#M69045</link>
      <description>&lt;P&gt;Thank you, I'll rewrite it in the fashion you suggested and try some additional debugging.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 16:19:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499115#M69045</guid>
      <dc:creator>UBComma</dc:creator>
      <dc:date>2022-05-06T16:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499117#M69046</link>
      <description>&lt;P&gt;The code above was a sample. I sent the actual code in a private message to you&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 16:20:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499117#M69046</guid>
      <dc:creator>UBComma</dc:creator>
      <dc:date>2022-05-06T16:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499880#M69089</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="276221" data-lia-user-login="UBComma" class="lia-mention lia-mention-user"&gt;UBComma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 13:47:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499880#M69089</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-07T13:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the SUM of a subset from a running total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499883#M69090</link>
      <description>&lt;P&gt;Absolutely GENIUS &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;. thank you so much for helping me with this one. It really had me stumped.&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 14:06:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-SUM-of-a-subset-from-a-running-total/m-p/2499883#M69090</guid>
      <dc:creator>UBComma</dc:creator>
      <dc:date>2022-05-07T14:06:07Z</dc:date>
    </item>
  </channel>
</rss>

