我不确定这些值是如何计算的。 我们只能使用 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 |