I'm migrating some calculations from Google Sheets to BigQuery and need to write a SUMPRODUCT script that offsets each row.
Here is the data in Google Sheets form. Column_1, Column_2 are given, SUMPRODUCT is a calc:
Column_1 Column_2 SUMPRODUCT
0 1 0
5 0 10
0 1 0
5 0 5
Column 1 starts in cell A1.
SUMPRODUCT Formulas for each row are as follows:
=SUMPRODUCT(A2:A5,$B$2:$B$5)
=SUMPRODUCT(A3:A6,$B$2:$B$5)
=SUMPRODUCT(A4:A7,$B$2:$B$5)
=SUMPRODUCT(A5:A8,$B$2:$B$5)
In Biquery I can create the first SUMPRODUCT row using SELECT SUM (column_1 * column_2) AS SUMPRODUCT FROM Table_1
After this, Offsetting the column 1 array each row is challenging. My final data set will 500+ rows I need to do this for. I've also tried to OFFSET function in SQL but ran into errors.