我不確定這些值是如何計算的。 我們只能使用 Apr,因為它還有三個月,但測試次數不應該是 8 和唯一序列號的數量是 6 嗎?
很可能最簡單的方法是先創建匯總表,然後在那裡執行計算,因為每個月只有一行。
抱歉,顯示 1 月和 2 月的結果可能令人困惑。而且我沒有很好地解釋“前 3 個月”。這就是我的意思:對於四月摘要行,計算在二月、三月和四月運行的所有測試,併計算同一時間段內的所有唯一序列號。March 匯總行類似,但使用 Jan、Feb 和 March。我會接受 1 月和 2 月摘要的空白,或僅基於 1 月數據的 1 月和僅基於 1 月和 2 月數據的 2 月摘要。
關鍵是一些序列號在不同的月份進行了多次測試,如果我將時間範圍限制在 1 個月,那麼測試的數量與測試的唯一單元的數量是不准確的。
這絕對不是唯一的方法,而是一種可能的選擇
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(10),
Compress File When Saved(1),
New Column("Month",
Character,
"Nominal",
Set Values({"Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Mar", "Mar", "Apr", "Apr"})
),
New Column("Serial # of unit tested",
Numeric,
"Nominal",
Format("Best", 12),
Set Values([1001, 1001, 1002, 1002, 1003, 1004, 1005, 1006, 1006, 1006])
)
);
dt_results = New Table("Untitled 3",
Compress File When Saved(1),
New Column("Month", Character, "Nominal", Set Values({})),
New Column("# of tests, prior 3 months", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("# of unique SN tested, prior 3 months", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
//
order = {"Jan", "Feb", "Mar", "Apr"};
Summarize(dt, uniq_months = By(:Month));
For Each({cur_month}, uniq_months,
cur_month_idx = Contains(order, cur_month);
months_of_interest = If(cur_month_idx < 3,
order[1::cur_month_idx];
,
order[(cur_month_idx - 2)::cur_month_idx];
);
// number of tests is same as number of rows
rows_of_interest = dt << Get Rows Where(Contains(months_of_interest, :Month));
nr_of_tests = N Items(rows_of_interest);
// number of unique items we can get with associative array
unique_snrs = Associative Array(dt[rows_of_interest, "Serial # of unit tested"]) << get keys;
nr_of_unique = N Items(unique_snrs);
cur_month_result = Eval List({cur_month, nr_of_tests, nr_of_unique});
dt_results << Add Row(1);
dt_results[N Row(dt_results), 0] = cur_month_result;
);

如果你有多年,它將需要修改
我正在嘗試找到一種方法來總結滾動 3 個月期間的表格。我已經嘗試使用“滯後”和“col 滾動”功能的不同方法,但尚未成功。有什麼建議嗎?我正在使用 JMP 16
原始數據示例
月 | 測試單元的序列號 |
揚 | 1001 |
揚 | 1001 |
揚 | 1002 |
二月 | 1002 |
二月 | 1003 |
二月 | 1004 |
三月 | 1005 |
三月 | 1006 |
四月 | 1006 |
四月 | 1006 |
所需的匯總數據
月 | 前 3 個月的測試數量 | 前 3 個月測試的唯一 SN 數量 |
揚 | 3 | 2 |
二月 | 6 | 4 |
三月 | 8 | 6 |
四月 | 7 | 5 |