<?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: Rolling Sum + Max Condition in Dashboards &amp; Analytics Discussions</title>
    <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5921#M726</link>
    <description>&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/3"&gt;@JoeM&lt;/a&gt;&amp;nbsp;: My bad, Its working. I made some mistake while reading the columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI - one of our teammates found a solution using SQL - You can refer attached sql code.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jul 2024 07:03:07 GMT</pubDate>
    <dc:creator>nikhil_cr</dc:creator>
    <dc:date>2024-07-17T07:03:07Z</dc:date>
    <item>
      <title>Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5891#M715</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to achieve a rolling sum with a max condition. Basically trying to do a rolling sum but before we roll the 1st row sum to the next row we have to check with a condition if the rolling value is less than or equal to Zero. If it is less than zero we have to make it as zero else we will roll the sum with the +ve value. Please see attached sample. Column in Green is something which we have to achieve.&lt;/P&gt;&lt;P&gt;Note: Please see comment in cell&amp;nbsp;&lt;STRONG&gt;P11. &lt;/STRONG&gt;Please provide a solution on the MV side as the calculation will be further used in other tables.&lt;/P&gt;&lt;P&gt;Appreciate your help&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nikhil&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 06:40:19 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5891#M715</guid>
      <dc:creator>nikhil_cr</dc:creator>
      <dc:date>2024-07-11T06:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5895#M716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/523"&gt;@nikhil_cr&lt;/a&gt;&amp;nbsp; - try the following:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import pandas as pd

df = read(schema.table)

df['Stock on Day With Max Rollingv2'] = df.apply(
    lambda row: max(0, row['Initial Stock Final'] + row['Outstanding Quantity'] - row['Forecast']),
    axis=1
)

print(df)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 12 Jul 2024 18:23:38 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5895#M716</guid>
      <dc:creator>JoeM</dc:creator>
      <dc:date>2024-07-12T18:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5909#M718</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/523"&gt;@nikhil_cr&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Can you clarify if these both columns are interdependent on each other for calculation ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Spd_0303_0-1721037021481.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/2668iE1893F4718F12901/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Spd_0303_0-1721037021481.png" alt="Spd_0303_0-1721037021481.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 09:50:43 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5909#M718</guid>
      <dc:creator>Spd_0303</dc:creator>
      <dc:date>2024-07-15T09:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5911#M719</link>
      <description>&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/3"&gt;@JoeM&lt;/a&gt;&amp;nbsp; - Thanks for the reply, But your code is not giving me the rolling sum.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/1052"&gt;@Spd_0303&lt;/a&gt;&amp;nbsp; - Yes they are dependent, except the 1st row. Once the stock on day for the 1st day is calculated, it will be our Initial Stock for the next day.&amp;nbsp; see snip -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nikhil_cr_0-1721041169543.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/2669i1E1A4AADE44E3A2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nikhil_cr_0-1721041169543.png" alt="nikhil_cr_0-1721041169543.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Stock on Day =&amp;nbsp;Initial Stock +&amp;nbsp;Outstanding Quantity -&amp;nbsp;Forecast&lt;/P&gt;&lt;P&gt;Please note Initial Stock for 2nd day would be the previous stock on day.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 11:04:21 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5911#M719</guid>
      <dc:creator>nikhil_cr</dc:creator>
      <dc:date>2024-07-15T11:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5914#M721</link>
      <description>&lt;P&gt;Value for value, I'm showing the same as you provided. Are you trying to replication something other than "Stock on Day with Max Rolling"?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeM_0-1721065805930.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/2670iA379727DA32FDF82/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeM_0-1721065805930.png" alt="JoeM_0-1721065805930.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 17:50:50 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5914#M721</guid>
      <dc:creator>JoeM</dc:creator>
      <dc:date>2024-07-15T17:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum + Max Condition</title>
      <link>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5921#M726</link>
      <description>&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/3"&gt;@JoeM&lt;/a&gt;&amp;nbsp;: My bad, Its working. I made some mistake while reading the columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI - one of our teammates found a solution using SQL - You can refer attached sql code.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 07:03:07 GMT</pubDate>
      <guid>https://community.incorta.com/t5/dashboards-analytics-discussions/rolling-sum-max-condition/m-p/5921#M726</guid>
      <dc:creator>nikhil_cr</dc:creator>
      <dc:date>2024-07-17T07:03:07Z</dc:date>
    </item>
  </channel>
</rss>

