我想在新列“运行编号”中创建一个公式,以根据其他列进行计数。例如:
样本测试运行编号
一个一1
一一2
一个两个1
一个两个2
乙一1
乙二 1
C一1
C一2
C 二 1
丙二 2
@JMPUser9 ,
@jthi提供了一个很好的答案。
不过,这个问题的答案之前已经在讨论社区中回答过多次。我请求在提交请求之前对过去的讨论进行搜索。
我搜索了“Count”,它返回了几个相关的回复。
谢谢
使用Col Cumulative Sum()是一种选择
Col Cumulative Sum(1, :Sample, :Test)
Col Rank()也是一个选项
Col Rank(:Sample, :Sample, :Test)
表格的完整示例
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(10),
Compress File When Saved(1),
New Column("Sample",
Character,
"Nominal",
Set Values({"A", "A", "A", "A", "B", "B", "C", "C", "C", "C"})
),
New Column("Test",
Character(16),
"Nominal",
Set Values({"one", "one", "two", "two", "one", "two", "one", "one", "two", "two"})
),
New Column("Run Number",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 2, 1, 2, 1, 1, 1, 2, 1, 2])
)
);
dt << New Column("RN", Numeric, Ordinal, Formula(
Col Cumulative Sum(1, :Sample, :Test)
));