turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- JSL: Cumulative calculation with different baselin...

Topic Options

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

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

Feb 3, 2016 10:13 PM
(749 views)

Hi,

Does anyone know of a way to write a script to perform separate cumulative calculations across rows based on different baselines? I'm trying to create a projected visit date report based off the max visit date for each subject.

The projected visit date column below shows the desired result based on the 'Max(VISITDT_RAW)' column + the cumulative sum from the 'Target Days from Previous Visit' column. The 'Cumulative Calculation" column shows the desired calculation for the Projected Visit Date column.

Any help I can get is much appreciated

Thanks!

Christine

1 ACCEPTED SOLUTION

Accepted Solutions

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

Solution

If you look for a formula column solution, the below approach should work. Just paste the code below into the formula edit field of the *Projected Visit Date* column. You may need to check that the column names match yours exactly.

:Name**(**"Max(VISITDT_RAW)"**)** + In Days**(**

Eval**(**Eval Expr**(**Col Sum**(**:Target Days from Previous Visit, Row**()** <= Expr**(**Row**())**, :Subject**)))**

**)**

If you add the formula by script it must be enclosed in *Name Expr( )*.

For very large tables a scripting solution would be more efficient.

2 REPLIES

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

If you look for a formula column solution, the below approach should work. Just paste the code below into the formula edit field of the *Projected Visit Date* column. You may need to check that the column names match yours exactly.

:Name**(**"Max(VISITDT_RAW)"**)** + In Days**(**

Eval**(**Eval Expr**(**Col Sum**(**:Target Days from Previous Visit, Row**()** <= Expr**(**Row**())**, :Subject**)))**

**)**

If you add the formula by script it must be enclosed in *Name Expr( )*.

For very large tables a scripting solution would be more efficient.

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

Feb 4, 2016 8:31 PM
(620 views)

Yay, this worked! This is great. Thanks so much for your help!!