How to sum the rows of a table with an expression in Vision

Is there an easy way to do this? The number of columns is dynamic.

Not for a varying number of columns, out of the box. The built in sum() expression function will do a column at a time.

If you can programmatically determine which columns to include, you could use the forEach() function from my free Simulation Aids module to sum the sums. Something like this (for v8.1.8+):

			sum({}, idx()),

The expression that determines whether to include a column can examine the column name as it()[0], the column type as it()[1] (in string abbreviated form), or the column index as idx().

1 Like

sum() seems to work only with columns. I want to sum the rows.

Example input and output dataset, please. I'm pretty sure I can get forEach() to get you an answer.