BookmarkSubscribe
Choose Language Hide Translation Bar
jamiesupica0
Community Trekker

How can I streamline my formula to relabel a time series?

I have a dataset of measurements taken before and after a process transition for ~300 machines.

 

sample table1.PNG

  • The number of days before and after a transition varies
  • The transition can happen on different Days

 

I inserted a formula that would label 3 days on either side of a transition day so I can select an idendical sample size for each of the 300 machines.

If(
	Lag( :Condition, -3 ) == "Transition", "1",
	Lag( :Condition, -2 ) == "Transition", "2",
	Lag( :Condition, -1 ) == "Transition", "3",
	:Condition == "Transition", "Transition",
	Lag( :Condition, 1 ) == "Transition", "4",
	Lag( :Condition, 2 ) == "Transition", "5",
	Lag( :Condition, 3 ) == "Transition", "6"
)

Which gives what I was hoping for

sample table.PNG

 

Using if statements like that feels...hacky.  Can anyone think of a more elegant way to do this?

 

0 Kudos
2 REPLIES 2
dale_lehman
Community Trekker

Re: How can I streamline my formula to relabel a time series?

I don't think this is any simpler - but it was better than making a New Year's resolution.  You might find something in here that you can use, however.  Attached is my version.

jamiesupica0
Community Trekker

Re: How can I streamline my formula to relabel a time series?

Thanks Dale, I didn't realize you could use a period for Null.

 

0 Kudos