<?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 Rolling Sum for a subset of data in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3707156#M144206</link>
    <description>&lt;P&gt;Hi Everybody,&lt;BR /&gt;&lt;BR /&gt;I am struggling&amp;nbsp;with a DAX Formula:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Calculation works for the overall time range, as you can see in the table,&lt;BR /&gt;but it doesn't&amp;nbsp;work for specified time range (15th to 23rd ).&lt;/P&gt;&lt;P&gt;The rolling sum for this time range should start with 0 instead of 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;This is my DAX Formula:&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#3366FF"&gt;Cumulative Rolling Sum Value_B = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; SUM('Sheet1'[Value_B]),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; FILTER(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL('Sheet1'),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Sheet1'[Date] &amp;lt;= MAX('Sheet1'[Date])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas what I am doing wrong ?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 07:47:48 GMT</pubDate>
    <dc:creator>MXSven</dc:creator>
    <dc:date>2024-02-19T07:47:48Z</dc:date>
    <item>
      <title>Rolling Sum for a subset of data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3707156#M144206</link>
      <description>&lt;P&gt;Hi Everybody,&lt;BR /&gt;&lt;BR /&gt;I am struggling&amp;nbsp;with a DAX Formula:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Calculation works for the overall time range, as you can see in the table,&lt;BR /&gt;but it doesn't&amp;nbsp;work for specified time range (15th to 23rd ).&lt;/P&gt;&lt;P&gt;The rolling sum for this time range should start with 0 instead of 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;This is my DAX Formula:&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;FONT color="#3366FF"&gt;Cumulative Rolling Sum Value_B = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; SUM('Sheet1'[Value_B]),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; FILTER(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL('Sheet1'),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Sheet1'[Date] &amp;lt;= MAX('Sheet1'[Date])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas what I am doing wrong ?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 07:47:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3707156#M144206</guid>
      <dc:creator>MXSven</dc:creator>
      <dc:date>2024-02-19T07:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum for a subset of data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3708124#M144259</link>
      <description>&lt;P&gt;It seems like you're trying to calculate a cumulative rolling sum for a specific time range in your data using DAX. The issue you're encountering is that your current formula calculates the rolling sum starting from the beginning of the dataset, whereas you want it to start from 0 for a specified time range.&lt;/P&gt;&lt;P&gt;To achieve the desired result, you need to modify your DAX formula to conditionally start the rolling sum from 0 for the specified time range. You can achieve this by adding an additional condition to your FILTER function.&lt;/P&gt;&lt;P&gt;Here's how you can modify your DAX formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cumulative Rolling Sum Value_B =&lt;BR /&gt;VAR StartDate = DATE(2024, 1, 15)&lt;BR /&gt;VAR EndDate = DATE(2024, 1, 23)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;IF(&lt;BR /&gt;MIN('Sheet1'[Date]) &amp;gt; StartDate,&lt;BR /&gt;0,&lt;BR /&gt;SUM('Sheet1'[Value_B])&lt;BR /&gt;),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('Sheet1'),&lt;BR /&gt;'Sheet1'[Date] &amp;lt;= MAX('Sheet1'[Date]) &amp;amp;&amp;amp;&lt;BR /&gt;'Sheet1'[Date] &amp;gt;= StartDate &amp;amp;&amp;amp;&lt;BR /&gt;'Sheet1'[Date] &amp;lt;= EndDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this modified formula:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I used two variables, StartDate and EndDate, to define your specified time range.&lt;/LI&gt;&lt;LI&gt;I used the IF function to check if the minimum date in your data is greater than the start date of the specified time range. If it is, the rolling sum starts from 0; otherwise, it calculates the sum normally.&lt;/LI&gt;&lt;LI&gt;I adjusted the FILTER function to include the conditions for the specified time range (between 15th and 23rd January 2024).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Please replace the StartDate and EndDate with your actual start and end dates. This formula should now calculate the cumulative rolling sum starting from 0 for the specified time range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 13:30:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3708124#M144259</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-19T13:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum for a subset of data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3710132#M144354</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks, 123abc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your proposed solution, but it is not calculating as I expected&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;Cumulative Rolling Sum Value_B = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VAR StartDate = MIN('Sheet1'[Date])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VAR EndDate = MAX('Sheet1'[Date])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;IF(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;MIN('Sheet1'[Date]) &amp;gt; StartDate,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SUM('Sheet1'[Value_B])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;FILTER(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;ALL('Sheet1'),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;'Sheet1'[Date] &amp;lt;= MAX('Sheet1'[Date]) &amp;amp;&amp;amp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;'Sheet1'[Date] &amp;gt;= StartDate &amp;amp;&amp;amp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;'Sheet1'[Date] &amp;lt;= EndDate&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;The only thing I did differently was to retrieve the start date and end date from the sliders, and I checked the values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 07:33:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-for-a-subset-of-data/m-p/3710132#M144354</guid>
      <dc:creator>MXSven</dc:creator>
      <dc:date>2024-02-20T07:33:01Z</dc:date>
    </item>
  </channel>
</rss>

