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
qspringleaf
Level III

New Create A column to count Cycle Time

Refer to below data table, how to New Create A column to count Cycle Time? kindly help to suggest. thanks a lot.

1.need sort properly by "Group Name" and "Date".

2. within same "Group Name", with "Date" increase, column"Count" number increases, after a certain level (the max value maybe not fixed, sometimes change), it will be back to small value, which means another cycle start.

 

qspringleaf_0-1594905324637.png

qspringleaf_1-1594905347493.png

Group NameDateCount
P14/22/2020 7:261
P14/22/2020 8:262
P14/22/2020 9:263
P14/22/2020 10:264
P14/22/2020 11:265
P14/22/2020 12:266
P14/22/2020 13:267
P14/22/2020 14:268
P14/22/2020 15:269
P14/22/2020 16:2610
P14/22/2020 17:2613
P14/22/2020 18:261
P14/22/2020 19:262
P14/22/2020 20:263
P14/22/2020 21:264
P14/22/2020 22:265
P14/22/2020 23:266
P14/23/2020 0:267
P14/23/2020 1:268
P14/23/2020 2:269
P14/23/2020 3:2610
P14/23/2020 4:2611
P14/23/2020 5:261
P14/23/2020 6:262
P14/23/2020 7:263
P14/23/2020 8:264
P14/23/2020 9:265
P14/23/2020 10:266
P14/23/2020 11:267
P14/23/2020 12:268
P14/23/2020 13:269
P14/23/2020 14:2610
P14/23/2020 15:2618
P24/22/2020 5:261
P24/22/2020 6:262
P24/22/2020 7:263
P24/22/2020 8:264
P24/22/2020 9:265
P24/22/2020 10:266
P24/22/2020 11:267
P24/22/2020 12:268
P24/22/2020 13:269
P24/22/2020 14:2610
P24/22/2020 15:2611
P24/22/2020 16:261
P24/22/2020 17:262
P24/22/2020 18:263
P24/22/2020 19:264
P24/22/2020 20:265
P24/22/2020 21:266
P24/22/2020 22:267
P24/22/2020 23:268
P24/23/2020 0:269
P24/23/2020 1:2610
P24/23/2020 2:2611
P24/23/2020 3:261
P24/23/2020 4:262
P24/23/2020 5:263
P24/23/2020 6:264
P24/23/2020 7:265
P24/23/2020 8:266
P24/23/2020 9:267
P24/23/2020 10:268
P24/23/2020 11:269
P24/23/2020 12:2610
P24/23/2020 13:2611
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: New Create A column to count Cycle Time

One just needs to check to see if the group changes and then reset myCycle

 
If(
	Row() == 1, myCycle = 1,
	:Group Name != Lag( :Group Name ), myCycle = 0
);
If( :Count < Lag( :Count ),
	myCycle
	++);
myCycle;

 

Jim

View solution in original post

4 REPLIES 4
Highlighted
txnelson
Super User

Re: New Create A column to count Cycle Time

Given your data table you provided, the following formula will work.  I have attached your data table with the formula applied

If( Row() == 1, myCycle = 1 );
If( :Count < Lag( :Count ),
	myCycle
	++);
myCycle;
Jim
Highlighted
qspringleaf
Level III

Re: New Create A column to count Cycle Time

thanks a lot, it works well for one group name, still need your suggestion on multiple group names.

actually this table have one column named "group name", in this column have P1 and P2 2 groups, what I want is "P1/P2 count cycle time separately".

so P2 start to count from "1" instead of "4".

thanks a lot.

 

qspringleaf_0-1595066563642.png

 

Highlighted
txnelson
Super User

Re: New Create A column to count Cycle Time

One just needs to check to see if the group changes and then reset myCycle

 
If(
	Row() == 1, myCycle = 1,
	:Group Name != Lag( :Group Name ), myCycle = 0
);
If( :Count < Lag( :Count ),
	myCycle
	++);
myCycle;

 

Jim

View solution in original post

Highlighted
qspringleaf
Level III

Re: New Create A column to count Cycle Time

Cool, it works well, thanks so much.
Article Labels