I want to find the number of columns in a range in each row which has non-null and >0 value.
I have done this currently using case when statements or IF-ELSE. But the number of columns that i have to now consider has increased and with that the number of case statements too.
So i wanted to create an array of the columns and then find the length of the array after excluding 0 and NULL values.
I tried the follow code but i am getting an error
**case1**
SELECT [col1,col2,col3,col4,col5] from input_Table
Error: Array cannot have a null element; error in writing field
**case2**
SELECT *,
ARRAY(SELECT col1,col2,col3,col4,col5
from input_table
WHERE col1 is not null and col2 is not null ...)
from input_Table
Error: ARRAY subquery cannot have more than one column unless using SELECT AS STRUCT to build STRUCT values at [2:3]
Below is a snapshot of my data

The output that i want is
1
2
0
It would be super helpful if somebody can help me with this, I am very new to Bigquery.