如何過濾以顯示最後 n 個項目/值?讓我們使用半導體能力樣本資料表作為背景。
列lot_id有13個等級。
假設我想在IMR控製圖中僅顯示資料表中最後一批或最後5批的資料。除了手動滾動lot_id列表並手動選擇最後5批資料外,還有其他優雅的方法來執行這種最後n次篩選嗎?
或者,我的數據表中有多年的過程感測器數據。我只想繪製最近六個月的數據。
基礎資料分析與建模品質與工藝工程回覆:如何過濾以顯示最後 n 個項目/值?對於第二個,您可以使用資料過濾器

您可能想要建立 YEAR-MONTH 列以使選擇更容易一些
對於第一個問題,順序是否僅基於資料表的行順序?對於半導體能力,它們是按字母順序排列的,因此您可以使用資料過濾器。

回覆:如何過濾以顯示最後 n 個項目/值?我將使用這些來建立分類列來標記最近的 xx 天、月份、年份,並在資料過濾器中使用它。
If( :Date >= Date DMY( 1, Month( Col Max( :Date ) ), Year( Col Max( :Date ) ) - 1 ),
"Yes",
"No"
)
If( Col Max( :Date ) - :Date <= In Days( 30 ),
"latest 30 days"
)
您可以修改最近 6 個月的
If(
:Date >= Date DMY( 1, Month( Col Max( :Date ) ), Year( Col Max( :Date ) ) )
-In Years( 0.5 ),
"Yes",
"No"
)
用於標記最新的X標籤
我將用它作為最新 2 個批次 ID/週期的範例。
1. 依編號重新分配批次或週期
If( Row() == 1,
1,
If( :Start Date == Lag( :Start Date ),
Lag( :cycle ),
Lag( :cycle ) + 1
)
)
或者這個
If( Row() == 1,
1,
If( :lot ID == Lag( :lot ID ),
Lag( :cycle 2 ),
Lag( :cycle 2 ) + 1
)
)
然後,建立此公式來標記最新的 xx ID 或週期(本例中為 2)
If( Col Max( :cycle ) - :cycle < 2,
"latest 2 cycles"
)
或者,您可以修改此腳本以在您的資料表上執行。
但是,每次資料更新時都需要重新執行此腳本。因此,我更喜歡上面的那個。
last_no = 2;
// Define your column names
timestampCol = "Start Date"; // Replace with your actual timestamp column name
categoryCol = "lot ID"; // Replace with your actual category column name
// Reference the current data table
dt = Current Data Table();
// Create a summary table with the latest timestamp per category
dtSummary = dt << Summary(
Group( column(categoryCol) ),
Max( column(timestampCol) ),
Link to original data table(0),
Output Table Name("LatestPerCategory")
);
// Sort the summary table by latest timestamp descending
dtSummary << Sort(
By( column("Max(" || timestampCol || ")") ),
Order(Descending),
Replace Table(1)
);
// Get the top 2 categories
latestCategories = {};
For( i = 1, i <= last_no, i++,
Insert Into( latestCategories, dtSummary:lot ID[i] )
);
// Add a new column to flag the latest 5 categories
dt << New Column("Is Latest " ||char(last_no),
Character,
Formula( If( Contains( latestCategories, :lot ID ), "Yes", "No" ) )
);
// Optional: Close the summary table
Close( dtSummary, NoSave );
這是我的測試數據

回覆:如何過濾以顯示最後 n 個項目/值?對於“最後 5 手”,您可以使用 Rank Reverse:

每個「站點」甚至可能最後有 5 個地段 - 就像螢幕截圖中那樣?

有點令人驚訝:x 軸沒有根據數據過濾器設定進行調整。
-> 大量空白
回覆:如何過濾以顯示最後 n 個項目/值?我使用了“Last.6.Months False/True”公式來建立子集。使用子集而不是過濾器,這樣控製圖中的子組就不會包含“Last.6.Months == 0”的案例。 
Names Default To Here( 1 );
dt = Current Data Table();
Last.6.Months.Data = dt << Subset( Filtered Rows(:Running? == 1 & :Last.6.Months == 1));
Last.6.Months.Data << Set Name("Last.6.Months.Data");
回覆:如何過濾以顯示最後 n 個項目/值?賈莫:
謝謝!我之前不知道「排名倒序」功能。我下週會試試看。
是的,x 軸問題就是我使用子集而不是資料過濾器的原因。
回覆:如何過濾以顯示最後 n 個項目/值?事實上,您是對的—必要的功能尚不可用。
讓我們從我的錯誤中學習:
Col Rank 根據行數進行計數 - 而不是根據批次進行計數。
因此每個晶圓都會有自己的編號。 ->這不是你想要的。
對不起。
但有一個美好的前景:
在版本 19 中,JMP 將獲得新功能:)
為 Ranking Tie 和 Col Rank 函數添加密集排名

目前,沒有一鍵式選項來計算唯一反向分數。
解決方法:
JMP19 中將新增另一個功能: Col N 類別 (:green_heart:)
這使我們能夠透過以下方式計算反向唯一分數:
(Col N Unique( :lot_id ) - Col N Unique( :lot_id )) + 1
@jthi ,合作很愉快:)
回覆:如何過濾以顯示最後 n 個項目/值?或者,可以手動新增唯一反向分數:

透過自訂函數
Add Custom Functions(
New Custom Function(
"COL",
"Score Unique_reverse_addExpr",
Function( {value},
Col N Unique( value) - Col Score (value) +1
),
<
<FORMULA category=""></FORMULA>
<BR /> <BR /> <P>但有以下限制:</P>
<UL>
<LI>缺少分組選項</LI>
<LI>必須在公式編輯器中手動新增<FONT face="courier new,courier">表達式()</FONT> (以防止過早評估參數):</LI>
</UL> <P><A href="https://community.jmp.com/t5/Discussions/Fast-Way-to-calculate-quot-nested-quot-Col-aggregations-like-MAD/m-p/888083/highlight/true#M105027" target="_blank">https://community.jmp.com/t5/Discussions/Fast-Way-to-calculate-quot-nested-quot-Col-aggregations-like-MAD/mp/888083/highlight/true#M105027</A> </P> <P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1753421633660.png" style="width: 400px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><span class="lia-inline-image-display-wrapper" image-alt="hogi_1-1753421633660.png" style="width: 324px;"><img src="https://us.v-cdn.net/6038925/uploads/images/78870i815199AB7B6D781F/hogi_1-1753421633660.png" role="button" title="hogi_1-1753421633660.png" alt="hogi_1-1753421633660.png" /></span></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
回覆:如何過濾以顯示最後 n 個項目/值?我們確實有相當不錯的“選擇最後”等配置級別,但遺憾的是,這些對於(名義/序數)數據過濾器來說是無法訪問的

資料過濾器可以從許多改進中受益,這可能是其中之一,所以也許是這種選擇類型的願望清單項目?
回覆:如何過濾以顯示最後 n 個項目/值?為 Ranking Tie 和 Col Rank 函數添加密集排名尚未標記為“是的,敬請期待”。
如果運氣好的話,他們可以在 9 月擠進 JMP19 的「反向」密集排名版本;)
回覆:如何過濾以顯示最後 n 個項目/值?好消息!從 JMP 19.0 開始,控制圖產生器新增了名為「設定最後 N 個子群組」的功能。此功能將調整 X 軸,使其始終顯示最近的 N 個子群組,無論資料或圖表如何更新。
回覆:如何過濾以顯示最後 n 個項目/值?謝謝你的確認,安妮!
我參加了你在Discovery24的演講,我覺得你提到了這一點,覺得這是一個進步。期待你的演講。