I have a small Dataset as shown below:
The Computed Points computation is as follows:
Numerator = Score/SUM(Score)
Denomenator = IF(Points = 0 SELECT Score ELSE SELECT Points)/SUM(Score)
Computed Points = Numerator/Denomenator
How to I write a Sql query for the same in BigQuery? Here is how my query looks like:
Select Date, Activity, Model (Score/Sum(Score))/(CASE Points
WHEN 0 THEN Score
ELSE Points
END)/(SUM(Points)) as `Computed_Points` from samples.test;
But this throws an error saying:
SELECT list expression references column Impressions which is neither grouped nor aggregated at [1:9]
Can someone please help me achieve this?

