Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- JSL to create a column that is a cumulative sum based on previous row of other c...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 7, 2020 7:41 AM
(131 views)

I am using JMP Pro 12.

I need help to create a new column ('cum_Qty') in JSL that will be an ongoing sum of the previous rows value in 'Qty'column until meet => 500. If the row qty is => 500 in , the value will update as it in the 'cum_Qty'.

Example:

In workweek 2, the qty is 633 (> 500) in 'Qty'column, this value is updated as 633 in 'çum_Qty' column.

In workweek 3, the qty is 185 (< 500), it sums 185 + 633 = 818, this value is updated in 'çum_Qty' column.

In workweek 4, the qty is 130 (<500), it sums 130 + 185 + 633 = 948, this value is updated in 'çum_Qty' column.

and so on.......Refer attached file for details.

Thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is one of the ways to code this. It is a column formula

```
If( Row() == 1, x = 0 );
If( :Qty > 500,
x = :Qty,
x = x + :Qty
);
x;
```

Jim

2 REPLIES 2

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is one of the ways to code this. It is a column formula

```
If( Row() == 1, x = 0 );
If( :Qty > 500,
x = :Qty,
x = x + :Qty
);
x;
```

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: JSL to create a column that is a cumulative sum based on previous row of other columns

Thanks Jim. It works perfectly!