If you have only three columns you could use Choose with checking of how many unique values there are. I'm using (N Items(Associative Array(Eval List({:A,:B,:C})) << get keys)
) for that here
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(6),
Compress File When Saved(1),
New Column("Movie", Character, "Nominal", Set Values({"Ocean's Eleven", "Airport", "Armageddon", "Batman", "Batman & Robin", "Batman Forever"})),
New Column("Year", Numeric, "Continuous", Format("Best", 12), Set Values([2001, 1970, 1998, 1989, 1997, 1995])),
New Column("A", Numeric, "Continuous", Set Values([183.4, 100.5, 201.6, 251.2, 107.3, 335])),
New Column("B", Numeric, "Continuous", Set Values([444.3, 100.5, 554.6, 413, 237.3, 335])),
New Column("C", Numeric, "Continuous", Set Values([183.4, 100.5, 271.6, 413, 107.3, 335])),
New Column("SUM", Numeric, "Continuous", Format("Best", 12), Set Values([2, 3, 0, 2, 2, 3]))
);
dt << New Column("SUM2", Numeric, Continuous, Formula(
Choose(N Items(Associative Array(Eval List({:A,:B,:C})) << get keys),
3,
2,
0
)
));
Edit:
As @txnelson said, Associative Array doesn't really work with non integer numeric values unless you transform the values somehow (you could try converting them to characters first or multiply). With three columns it will be short to write a formula with comparisons (like Jim did). Also instead of Associative Array you could use Design
dt << New Column("SUM2", Numeric, Continuous, Formula(
val = Max(V Sum(Design(Eval List({:A,:B,:C}))));
If(val > 1,
val
,
0
);
));
-Jarmo