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%3EComment%20puis-je%20faire%20en%20sorte%20que%20la%20fonction%20Lag%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9e%20%C2%BB%20%C3%A0%20chaque%20nouveau%20lot%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826802%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EBonjour%2C%3C%2FP%3E%3CP%3EJ'ai%20les%20donn%C3%A9es%20suivantes%20et%20je%20souhaite%20utiliser%20la%20fonction%20Lag%20pour%20calculer%20la%20diff%C3%A9rence%20entre%20chaque%20r%C3%A9sultat%20et%20le%20r%C3%A9sultat%20pr%C3%A9c%C3%A9dent%20(le%20tableau%20de%20donn%C3%A9es%20est%20%C3%A9galement%20joint%20%C3%A0%20ce%20message).%3C%2FP%3E%3CP%3EJ'utilise%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%3EActuellement%2C%20j'utilise%20la%20formule%20suivante%20dans%20la%20colonne%20%C2%AB%20Diff%C3%A9rence%20%C2%BB%20%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%3ECe%20que%20je%20n'arrive%20pas%20%C3%A0%20comprendre%2C%20c'est%20comment%20faire%20pour%20que%20le%20calcul%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9%20%C2%BB%20une%20fois%20qu'il%20arrive%20au%20lot%20B.%20Je%20me%20rends%20compte%20que%20m%C3%AAme%20avec%20ma%20formule%20actuelle%2C%20seule%20la%20valeur%20de%20diff%C3%A9rence%20de%20la%20ligne%2016%20est%20incorrecte%2C%20mais%20je%20saurais%20quand%20m%C3%AAme%20configurer%20la%20formule%20pour%20qu'elle%20fonctionne%20correctement%20dans%20les%20lots.%3C%2FP%3E%3CP%3EQuelqu'un%20a-t-il%20des%20suggestions%20%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%3EAnalyse%20et%20mod%C3%A9lisation%20de%20donn%C3%A9es%20de%20base%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%20%3A%20Comment%20puis-je%20faire%20en%20sorte%20que%20la%20fonction%20Lag%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9e%20%C2%BB%20%C3%A0%20chaque%20nouveau%20lot%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Echangez%20votre%20formule%20en%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%20%3A%20Comment%20puis-je%20faire%20en%20sorte%20que%20la%20fonction%20Lag%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9e%20%C2%BB%20%C3%A0%20chaque%20nouveau%20lot%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826813%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EVous%20pouvez%20%C3%A9galement%20utiliser%20Col%20Moving%20Average%20pour%20obtenir%20la%20valeur%20pr%C3%A9c%C3%A9dente%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%3EPr%C3%A9paration%20des%20donn%C3%A9es%20-%20soustraire%20les%20donn%C3%A9es%20de%20la%20colonne%20par%20une%20autre%20colonne%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%3Emais%20dans%20votre%20cas%2C%20il%20est%20probablement%20pr%C3%A9f%C3%A9rable%20d'utiliser%20quelque%20chose%20comme%20celui%20sugg%C3%A9r%C3%A9%20par%20Jim.%20Il%20existe%20%C3%A9galement%20la%20fonction%20Dif%20que%20vous%20pouvez%20utiliser%20%C3%A0%20la%20place%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%20%3A%20Comment%20puis-je%20faire%20en%20sorte%20que%20la%20fonction%20Lag%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9e%20%C2%BB%20%C3%A0%20chaque%20nouveau%20lot%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826826%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EMerci%20pour%20les%20r%C3%A9ponses%20rapides%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%3EMerci%20beaucoup%20!!%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%20%3A%20Comment%20puis-je%20faire%20en%20sorte%20que%20la%20fonction%20Lag%20soit%20%C2%AB%20r%C3%A9initialis%C3%A9e%20%C2%BB%20%C3%A0%20chaque%20nouveau%20lot%20%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%20vous%20avez%20fr%C3%A9quemment%20besoin%20de%20telles%20op%C3%A9rations%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Ede%20d%C3%A9calage%3C%2FFONT%3E%20group%C3%A9es%2C%20vous%20pouvez%20jeter%20un%20%C5%93il%20%C3%A0%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%20sur%20la%20Marketplace.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Il%20a%20impl%C3%A9ment%C3%A9%20le%20N-1%20en%20combinaison%20avec%20le%20regroupement%20bas%C3%A9%20sur%20l'approche%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%26nbsp%3B%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%3ECela%20%C3%A9vite%20la%20peine%20de%20se%20souvenir%20de%20la%20syntaxe%20exacte%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%3EDe%20plus%2C%20la%20plateforme%20g%C3%A8re%20automatiquement%20les%20lignes%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eexclues%3C%2FFONT%3E%20.%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