Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
saitcopuroglu
Level IV

CumSum with more than one variable

Need some help here.

I have this script for Cumulative Summary of NetRoomRevenueWithoutVat column by Year.

I would like to add another or two variable let's say by Year and By Agency and By Location (could be character or numeric).

Thank you in advance

If( Row() == 1 | Lag( :Year ) != :Year,

  :NetRoomRevenueWithOutVat,

  Lag( :CumSumByYear ) + :NetRoomRevenueWithOutVat

)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ms
Super User ms
Super User

Re: CumSum with more than one variable

If the table is adequately sorted, I think this formula could work:

If(Row() == 1 | Lag(Eval List({:Year, :Agency, :Location})) != Eval List({:Year, :Agency, :Location}),

    :NetRoomRevenueWithOutVat,

    Lag(:CumSumByYear) + :NetRoomRevenueWithOutVat

)

View solution in original post

4 REPLIES 4
Highlighted
ms
Super User ms
Super User

Re: CumSum with more than one variable

If the table is adequately sorted, I think this formula could work:

If(Row() == 1 | Lag(Eval List({:Year, :Agency, :Location})) != Eval List({:Year, :Agency, :Location}),

    :NetRoomRevenueWithOutVat,

    Lag(:CumSumByYear) + :NetRoomRevenueWithOutVat

)

View solution in original post

Highlighted
saitcopuroglu
Level IV

Re: CumSum with more than one variable

Thank you Michael! Would this help? michael@jmp

8349_Screen Shot 2015-03-13 at 14.02.26.png

Highlighted
ms
Super User ms
Super User

Re: CumSum with more than one variable

It might. But what the optimal sorting would look like depends on the structure/hierarchy of your data. Only you can tell.

Btw, I'm not Michael...

saitcopuroglu
Level IV

Re: CumSum with more than one variable

Ohh I am sorry!!! Really Sorry!! I thought you are Michael Crotty Mixed the MS with MC

Thank you a lot!

Article Labels

    There are no labels assigned to this post.