Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
richters
Partner - Contributor III
Partner - Contributor III

Sum of numbered columns

Hi all,

is there a possibility to sum up or concat numbered columns?

I implemented a loop which creates columns named like : col_0, col_1, ...col_x

I know the number of created columns by a variable (x).

Does anyone know how to work with a flexible number of columns?

Thank you!

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Maybe something like rangesum($(=concat( 'col_'&ValueLoop(1,x),',')))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Maybe something like rangesum($(=concat( 'col_'&ValueLoop(1,x),',')))


talk is cheap, supply exceeds demand
richters
Partner - Contributor III
Partner - Contributor III
Author

I used a construction like this:

LET x = 10;

LET vCols = 'rangesum(col_1' ;

for i = 2 to $(x);

LET vCols = '$(vCols)' & ', col_' & $(i);

next

SET vCols = $(vCols));

Thank you!