cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
%3CLINGO-SUB%20id%3D%22lingo-sub-628207%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EEinstellbare%20Verz%C3%B6gerungsdifferenz%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-628207%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EIch%20wei%C3%9F%20nicht%2C%20wie%20ich%20das%20betiteln%20soll%2C%20aber%20hier%20ist%20es.%20Ich%20habe%20Datens%C3%A4tze%20mit%20mehreren%20Zeitpunkten%20pro%20Stapel.%20F%C3%BCr%20jede%20Charge%20m%C3%B6chte%20ich%20die%20Differenz%20der%20Ergebnisse%20zum%20Zeitpunkt%20Null%20berechnen.%20Fr%C3%BCher%20habe%20ich%20jedes%20Ergebnis%20mit%20dem%20Minimum%20oder%20Maximum%20der%20Spalte%20(je%20nach%20Bedarf)%20verglichen%2C%20was%20gut%20funktioniert%20hat%2C%20aber%20wenn%20die%20Ergebnisse%20etwas%20schwanken%2C%20kann%20das%20Maximum%20oder%20Minimum%20zu%20einem%20anderen%20Zeitpunkt%20als%20Null%20auftreten.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIch%20m%C3%B6chte%20das%20(gew%C3%BCnschte)%20Diff%20wie%20unten.%20Gibt%20es%20eine%20einfache%20M%C3%B6glichkeit%2C%20dies%20in%20einer%20Formel%20zu%20tun%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ake_0-1683127236504.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ake_0-1683127236504.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ake_0-1683127236504.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52527i61243B9B9175A74B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Ake_0-1683127236504.png%22%20alt%3D%22Ake_0-1683127236504.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ejmp%2017.1%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-628207%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EInhaltsorganisation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMassenanpassung%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQualit%C3%A4ts-%20und%20Verfahrenstechnik%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EErgebnisse%20teilen%20und%20kommunizieren%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-628238%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Einstellbare%20Verz%C3%B6gerungsdifferenz%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-628238%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EF%C3%BCgen%20Sie%20einfach%20einige%20m%C3%B6gliche%20Optionen%20hinzu%2C%20wenn%20die%20Daten%20nicht%20immer%20sortiert%20sind.%3C%2FP%3E%0A%3CP%3EVerwendung%20von%20Matrixberechnungen%20zur%20Ermittlung%20der%20Indizes%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EAs%20Constant(%0A%20times%20%3D%20%3ATime%20%26lt%3B%26lt%3B%20get%20as%20matrix%3B%0A%20batches%20%3D%20%3ABatch%20%26lt%3B%26lt%3B%20get%20as%20matrix%3B%0A)%3B%0A%0Abatch_rows%20%3D%20Loc(batches%2C%20%3ABatch)%3B%0Abatch_first_time_row%20%3D%20batch_rows%5BLoc%20Min(times%5Bbatch_rows%5D)%5D%3B%0A%3AResult%20-%20%3AResult%5Bbatch_first_time_row%5D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eund%20Col%20Sum%20verwenden%2C%20um%20den%20Mindestwert%20mit%20Vergleich%20und%20Produkt%20zu%20erhalten%20(wenn%20%3ATime%20nicht%20ist%2C%20ist%20der%20kleinste%20Multiplikator%200).%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3AResult%20-%20Col%20Sum((%3ATime%20%3D%3D%20Col%20Min(%3ATime%2C%20%3ABatch))%20*%20%3AResult%2C%20%3ABatch)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-628237%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Einstellbare%20Verz%C3%B6gerungsdifferenz%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-628237%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDer%20einfachste%20Weg%20(meiner%20Meinung%20nach)%20zu%20sehen%2C%20wie%20es%20funktioniert%2C%20besteht%20darin%2C%20diese%20Formel%20in%20drei%20verschiedene%20Formeln%20zu%20unterteilen%3C%2FP%3E%0A%3CP%3EErstes%20(BatchMinRow)%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ECol%20Min(Row()%2C%20%3ABatch)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EZweitens%20mit%20der%20gerade%20erstellten%20BatchMinRow%20(BatchMinVal)%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3AResult%5B%3ABatchMinRow%5D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eund%20schlie%C3%9Flich%20der%20dritte%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3AResult%20-%20%3ABatchMinVal%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EDadurch%20ist%20es%20viel%20einfacher%20zu%20erkennen%2C%20was%20die%20verschiedenen%20Teile%20in%20der%20Formel%20bewirken%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-628236%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Einstellbare%20Verz%C3%B6gerungsdifferenz%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-628236%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVielen%20Dank%20f%C3%BCr%20die%20%C3%A4u%C3%9Ferst%20schnelle%20und%20n%C3%BCtzliche%20Antwort!%20Ich%20werde%20dar%C3%BCber%20nachdenken%2C%20wie%2C%20aber%20ich%20sehe%2C%20dass%20es%20funktioniert!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-628220%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Einstellbare%20Verz%C3%B6gerungsdifferenz%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-628220%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EWenn%20die%20Ergebnisse%20geordnet%20sind%2C%20k%C3%B6nnten%20Sie%20etwa%20Folgendes%20verwenden%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3AResult%20-%20%3AResult%5BCol%20Min(Row()%2C%20%3ABatch)%5D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ECol%20Min(Row()%2C%20%3ABatch)%20ruft%20die%20erste%20Zeile%20f%C3%BCr%20einen%20bestimmten%20Batch%20ab%20und%20dann%20k%C3%B6nnen%20wir%20mit%20%3AResult%5Brownr%5D%20auf%20diese%20Zeile%20zugreifen.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_0-1683129377019.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1683129377019.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1683129377019.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52529iCEB18B68495316F3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_0-1683129377019.png%22%20alt%3D%22jthi_0-1683129377019.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWenn%20die%20Daten%20nicht%20immer%20geordnet%20sind%2C%20ist%20das%20kein%20wirkliches%20Problem%2C%20aber%20es%20erfordert%20eine%20andere%20Formel%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Ake
Ake
Level III

Adjustable Lag Difference?

Don't know how to title this but here goes. I have data sets with several time points per batch. For each batch I want to calculate the difference in results from time point zero. I used to compare each result to column min or max (as suitable) which worked fine, but when results are a bit jumpy, the max or min may happen at another time point than zero.

 

I want the (desired) diff as below. Is there a simple way to do this in a formula? 

 

Ake_0-1683127236504.png

jmp 17.1

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Adjustable Lag Difference?

If the results are ordered, you could use something like this:

:Result - :Result[Col Min(Row(), :Batch)]

Col Min(Row(), :Batch) will get the first row for specific batch and then we can access that row by using :Result[rownr].

jthi_0-1683129377019.png

If the data isn't always ordered it isn't really a problem, but it will require different formula

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Adjustable Lag Difference?

If the results are ordered, you could use something like this:

:Result - :Result[Col Min(Row(), :Batch)]

Col Min(Row(), :Batch) will get the first row for specific batch and then we can access that row by using :Result[rownr].

jthi_0-1683129377019.png

If the data isn't always ordered it isn't really a problem, but it will require different formula

-Jarmo
Ake
Ake
Level III

Re: Adjustable Lag Difference?

Thanks for extremely fast, and useful, response! I will ponder how, but I see it works!

jthi
Super User

Re: Adjustable Lag Difference?

Easiest way (in my opinion) to see how it works is to divide that formula into three different formulas

First one (BatchMinRow)

Col Min(Row(), :Batch)

Second using the just created BatchMinRow (BatchMinVal)

:Result[:BatchMinRow]

and finally third one

:Result - :BatchMinVal

this makes it much easier to see what the different parts in the formula do

-Jarmo
jthi
Super User

Re: Adjustable Lag Difference?

Just adding few possible options if the data isn't always sorted.

Using matrix calculations to get the indices

 

As Constant(
	times = :Time << get as matrix;
	batches = :Batch << get as matrix;
);

batch_rows = Loc(batches, :Batch);
batch_first_time_row = batch_rows[Loc Min(times[batch_rows])];
:Result - :Result[batch_first_time_row];

and using Col Sum to get the minimum value with comparison and product (if :Time isn't the smallest multiplier is 0).

:Result - Col Sum((:Time == Col Min(:Time, :Batch)) * :Result, :Batch);

 

 

 

-Jarmo

Recommended Articles