Subscribe Bookmark RSS Feed

Counting formula to identify different groups in timed data

Swalo66

Community Trekker

Joined:

Apr 28, 2015

I have timed data (Turn-up Time) I used to create a Time Differnce column to easily identify different run sequences.  What I am struggling with is how to use this to creat a new column (Run Number) that automatically groups the data.  Ideas?

Example.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This script should do the trick:

Names Default To Here( 1 );
dt = Current Data Table();

dt << New Column( "Run Number",
	character,
	formula(
		If( Row() == 1, runnum = 1 );
		If( :Time Difference Min > Col Mean( :Time Difference Min ) + Col Std Dev( :Time Difference Min ),
			runnum = runnum + 1
		);
		runnum;
	)
);
Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This script should do the trick:

Names Default To Here( 1 );
dt = Current Data Table();

dt << New Column( "Run Number",
	character,
	formula(
		If( Row() == 1, runnum = 1 );
		If( :Time Difference Min > Col Mean( :Time Difference Min ) + Col Std Dev( :Time Difference Min ),
			runnum = runnum + 1
		);
		runnum;
	)
);
Jim
Swalo66

Community Trekker

Joined:

Apr 28, 2015

Jim,  works perfectly, many thanks!!