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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Cumulative Summation by Group

- 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

Jun 10, 2009 9:00 AM
(883 views)

Summation( ::i = 1, Row(), :Total WIP[::i, Empty()] )

However, I need to do a separate cumulative sum for each "segment" I have in another column (i.e. I need a cumulative sum where :seg==1, and then a separate one where :seg==2, however I can't get the index to re-set itself when the seg value changes)

Any help would be greatly appreciated.

3 REPLIES

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

Jun 10, 2009 10:09 AM
(731 views)

-There is a column specifying the group, called "Seg".

-There is the data column, called "Y".

-The column containing the cumulative sum formula is called "Cum Sum".

The formula in the Cum Sum column is:

If( Row() == 1, :Y,

:Seg[Row()] == :Seg[Row() - 1], :Cum Sum[Row() - 1] + :Y[Row()],

:Seg[Row()] != :Seg[Row() - 1], :Y[Row()]

)

This formula only works if the data table is sorted by seg, and the Y column is in the order you want.

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

Jun 10, 2009 11:06 AM
(731 views)

Thank you, that gets me a whole lot closer, and while it does partially re-set where Seg changes, the cumulative sum itself doesn't reset still?

My table is sorted by Seg and the Y column (Total WIP) is in the order I want it in.

If(

Row() == 1, :Total WIP,

:Seg[Row()] == :Seg[Row() - 1],

:Cum Sum[Row() - 1] + :Total WIP[Row()],

:Seg[Row()] != :Seg[Row() - 1], :Total WIP[Row()]

)

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

Jun 22, 2009 10:12 AM
(731 views)