cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-826802%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%C2%BFC%C3%B3mo%20puedo%20lograr%20que%20la%20funci%C3%B3n%20de%20retraso%20se%20%22reinicie%22%20con%20cada%20nuevo%20lote%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826802%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHola%2C%3C%2FP%3E%3CP%3ETengo%20los%20siguientes%20datos%20y%20quiero%20usar%20la%20funci%C3%B3n%20Lag%20para%20calcular%20la%20diferencia%20entre%20cada%20resultado%20y%20el%20resultado%20anterior%20(la%20tabla%20de%20datos%20tambi%C3%A9n%20est%C3%A1%20adjunta%20a%20este%20mensaje).%3C%2FP%3E%3CP%3EEstoy%20usando%20JMP%2016.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_2-1736542505146.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F71841i5F4F56B3D78F55ED%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jgross_2-1736542505146.png%22%20alt%3D%22jgross_2-1736542505146.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EActualmente%20estoy%20usando%20la%20siguiente%20f%C3%B3rmula%20en%20la%20columna%20%22Diferencia%22%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20285px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20285px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20285px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20285px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jgross_0-1736542408545.png%22%20style%3D%22width%3A%20285px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F71839i66022B4EC7E17064%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jgross_0-1736542408545.png%22%20alt%3D%22jgross_0-1736542408545.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ELo%20que%20no%20puedo%20entender%20es%20c%C3%B3mo%20hacer%20que%20el%20c%C3%A1lculo%20se%20%22reinicie%22%20una%20vez%20que%20llega%20al%20lote%20B.%20Me%20doy%20cuenta%20de%20que%20incluso%20con%20mi%20f%C3%B3rmula%20actual%2C%20solo%20el%20valor%20de%20diferencia%20en%20la%20fila%2016%20es%20incorrecto%2C%20pero%20a%C3%BAn%20as%C3%AD%20sabr%C3%ADa%20configurar%20la%20f%C3%B3rmula%20para%20que%20funcione%20correctamente%20dentro%20de%20los%20lotes.%3C%2FP%3E%3CP%3E%C2%BFAlguien%20tiene%20alguna%20sugerencia%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EJeff%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-826802%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAn%C3%A1lisis%20y%20modelado%20de%20datos%20b%C3%A1sicos%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-826812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%C2%BFC%C3%B3mo%20puedo%20lograr%20que%20la%20funci%C3%B3n%20de%20retraso%20se%20%22reinicie%22%20con%20cada%20nuevo%20lote%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ecambia%20tu%20f%C3%B3rmula%20a%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20%3A%22Time%20Point%20(months)%22n%20%3D%3D%200%2C%0A%09.%2C%0A%09%3AResult%20-%20Lag(%20%3AResult%20)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-826813%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%C2%BFC%C3%B3mo%20puedo%20lograr%20que%20la%20funci%C3%B3n%20de%20retraso%20se%20%22reinicie%22%20con%20cada%20nuevo%20lote%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826813%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ETambi%C3%A9n%20puede%20utilizar%20la%20media%20m%C3%B3vil%20de%20columnas%20para%20obtener%20el%20valor%20anterior%20(%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FDiscussions%2FData-preparation-substract-column-data-by-other-column%2Fm-p%2F762950%23U762950%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3Epreparaci%C3%B3n%20de%20datos%3A%20restar%20los%20datos%20de%20la%20columna%20por%20otra%20columna%3C%2FA%3E%20)%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3AResult-%20(Col%20Moving%20Average(%3AResult%2C%201%2C%201%2C%200%2C%20%3ALot%20Number)%20*%202%20-%20%3AResult)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EPero%20en%20tu%20caso%2C%20probablemente%20sea%20mejor%20usar%20algo%20como%20lo%20que%20sugiri%C3%B3%20Jim.%20Tambi%C3%A9n%20existe%20la%20funci%C3%B3n%20Dif%20que%20puedes%20usar%20en%20lugar%20de%20Lag.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20%3A%22Time%20Point%20(months)%22n%20%3D%3D%200%2C%0A%09.%2C%0A%09Dif(%3AResult%2C%201)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-826826%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%C2%BFC%C3%B3mo%20puedo%20lograr%20que%20la%20funci%C3%B3n%20de%20retraso%20se%20%22reinicie%22%20con%20cada%20nuevo%20lote%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826826%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGracias%20por%20las%20respuestas%20r%C3%A1pidas%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2687%22%20target%3D%22_blank%22%3E%40txnelson%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%3C%2FP%3E%3CP%3E%C2%A1%C2%A1%C2%A1Muchas%20gracias!!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-826840%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%C2%BFC%C3%B3mo%20puedo%20lograr%20que%20la%20funci%C3%B3n%20de%20retraso%20se%20%22reinicie%22%20con%20cada%20nuevo%20lote%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826840%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ESi%20necesita%20este%20tipo%20de%20operaciones%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Ede%20retardo%3C%2FFONT%3E%20agrupadas%20con%20frecuencia%2C%20puede%20echar%20un%20vistazo%20a%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fmarketplace.jmp.com%2Fappdetails%2FNormalization%2BGUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmarketplace.jmp.com%2Fappdetails%2FNormalization%2BGUI%3C%2FA%3E%20en%20el%20Marketplace.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Implement%C3%B3%20el%20N-1%20en%20combinaci%C3%B3n%20con%20la%20agrupaci%C3%B3n%20basada%20en%20el%20enfoque%20de%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%20%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_0-1736585657173.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1736585657173.png%22%20style%3D%22width%3A%20269px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F71851iD016D41706668FF7%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hogi_0-1736585657173.png%22%20alt%3D%22hogi_0-1736585657173.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EEsto%20evita%20el%20dolor%20de%20recordar%20la%20sintaxis%20exacta%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Acara_con_una_leve_sonrisa%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3EAdem%C3%A1s%2C%20la%20Plataforma%20maneja%20las%20filas%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eexcluidas%3C%2FFONT%3E%20autom%C3%A1ticamente.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
jeff_gross
Level I

How Can I Get The Lag Function to "Reset" With Each New Batch?

Hello, 

I have the following data and I want to use the Lag function to calculate the difference between each result and the result prior to it (the data table is also attached to this message).

I am using JMP 16.

 

jgross_2-1736542505146.png

Currently I'm using the following formula in the "Difference" column:

jgross_0-1736542408545.png

What I can't figure out is how to get the calculation to "reset" once it gets to Batch B. I realize that even with my current formula, only the difference value in row 16 is incorrect, but still I would know to setup the formula so that it works properly within batches.

Does anyone have any suggestions?

 

Jeff

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How Can I Get The Lag Function to "Reset" With Each New Batch?

change your formula to

If( :"Time Point (months)"n == 0,
	.,
	:Result - Lag( :Result )
)

 

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How Can I Get The Lag Function to "Reset" With Each New Batch?

change your formula to

If( :"Time Point (months)"n == 0,
	.,
	:Result - Lag( :Result )
)

 

Jim
jeff_gross
Level I

Re: How Can I Get The Lag Function to "Reset" With Each New Batch?

Thank you for the quick replies @txnelson @jthi 

Much appreciated!!

hogi
Level XII

Re: How Can I Get The Lag Function to "Reset" With Each New Batch?

If you need such grouped lag operations frequently, you might have a look at 
https://marketplace.jmp.com/appdetails/Normalization+GUI in the Marketplace.

It implemented the N-1 in combination with grouping based on  @jthi 's approach:

hogi_0-1736585657173.png

 

This takes the pain to remember the exact syntax : )

In addition, the Platform handles Excluded rows automatically.

jthi
Super User

Re: How Can I Get The Lag Function to "Reset" With Each New Batch?

You can also utilize Col Moving Average to get the previous value (Data preparation- substract column data by other column )

:Result- (Col Moving Average(:Result, 1, 1, 0, :Lot Number) * 2 - :Result)

but in your case using something like Jim suggested is most likely better. Also there is Dif function you can use instead of Lag

If( :"Time Point (months)"n == 0,
	.,
	Dif(:Result, 1)
)
-Jarmo