条件付きの前の行の値のローリング合計私のデータは2つの列、Lot#&Qtyで始まります。
前の行の値のローリング合計(現在の行+前の2行)を計算するスクリプトを作成するのに助けが必要です。
ロジックは以下の表のように説明されます。

スクリプティングRe:条件付きの前の行の値のローリング合計1つの方法は、次のような式を使用することです。

If( Row() == 1,
:Qty,
If( Row() == 2,
Lag( :Qty, 1 ) + :Qty,
:Qty + Lag( :Qty, 1 ) + Lag( :Qty, 2 )
)
)
最初の行は合計するものがないため、行1のみを使用します
2行目には、現在と前の2つの値しかないため、その行+ラグ(1)
2行目以降のすべての行は、現在の行と前の2つの行の合計を取ります:lag(1)とlag(2)
Re:条件付きの前の行の値のローリング合計式を使用するアイデアを証明してくれてありがとう。
一部のロットデータはカウントされないため、データセットで公式を使用してローリングサムを直接実行できません。
例、
ロット番号3およびロット番号3.2、ロット番号3.2のみが最終ロット数量であるため、ローリング合計にカウントされます。
ロット#3に数量が追加されました。 Lot#3.2になります。
ロット番号7、7、2、7、3とロット番号10、10.3でも同じです。
ロット番号7.3の数量と10.3は最終ロット数量であるため、ローリング合計に含まれます。
コミュニティからのガイダンスが必要です。

Re:条件付きの前の行の値のローリング合計ええ、私は今それを手に入れました。
各ロットの最大値を見つけ、現在と最後の2つの最大ロット値のローリング合計を取る必要があります。
私は潜んでいる解決策があるように感じます、その解決策についてもう少し考える必要があるかもしれません。
Re:条件付きの前の行の値のローリング合計これを取得する方法を理解します。
誰かがこれに対する解決策を持っている場合に備えて、同様に共有してください。
ありがとう。
Re:条件付きの前の行の値のローリング合計これは正しいですか。 (写真の一番右の列)?

Re:条件付きの前の行の値のローリング合計はいそうです。
しかし、この結果を得るために、いくつかの行を除外せずに元のデータテーブルを維持したいと思います。
これはできますか?
Re:条件付きの前の行の値のローリング合計このスクリプトをデータテーブルに追加して、試してみてください
dt1=current data table();
//I want to get the max quantity by lot, so I'm adding a new column to change all the lots back to their non-decimal value.
dt1<< New Column("Lot Actual", formula(If( :Qty == Col Maximum( :Qty, Char( Round( Num( :Lot# ), 0 ) ) ),
:Lot#,
.
)));<BR />//this next formula column excludes rows that aren't the max Qty by lot
dt1<< New Column( "Lot Values in One Formula",
Formula(
If( :Lot Actual == "",
Row State( row() ) = Excluded State( 1 );
Excluded( Row State( row() ) );
1;
)
)
);
dt1<<RUN formulas=""></RUN>//once all the formulas for tagging the data are added, we can use Tabulate to get a subset of just the important rows.<BR />//There are lots of other ways to do this, this just happened to be the method of the day
obj1=dt1 << Tabulate(
Add Table(
Column Table( Analysis Columns( :Qty ) ),
Row Table( Grouping Columns( :Lot# ) )
)
);
dt2=obj1 << Make Into Data Table;
column(dt2,2)<<SET name=""></SET><BR />//Finally here is the rolling sum of the last three lots<BR />//there is moving average function we could have used, it would have looked simpler but more abstract
dt2<<NEW column=""></NEW>//<BR />//This part joins the values from the separate table back to the original table<BR />
dt1 << Update(
With( dt2 ),
Match Columns( :Lot# = :Lot# )
);
close(dt2, nosave);
obj1<<CLOSE window=""></CLOSE>//I feel like this step is cheating a little. This step just repeats the missing values down to the next non-missing<BR />//row. Its some code I got from Brady Brady a ways back. Different iterations of come in handy from time to time.
<BR />dtnr=current data table();
dtcollist=dtnr<<GET column="" names=""></GET>