Hello - I have a table with data that looks like this:
|year - string | month - string | Answer - string | Weight - float|
| 2022 | 12 | Y | 20 |
| 2022 | 12 | N | 15 |
| 2022 | 11 | Y | 11 |
| 2022 | 11 | N | 30 |
I am trying to use SQL Custom Query to output a table that calculates a field ‘Rate’ which is equal to:
Rate = Weight N / (Weight N + Weight Y) for each date where Answer = N
I have calculated a field ‘Date’ already
The end result should look something like this:
|year - string | month - string | Date - Date| Answer - string | Weight - float | Rate - float |
| 2022 | 12 | 2022/12/1 | Y | 20 | |
| 2022 | 12 |. 2022/12/1 | N | 15 | (15)/(15+20) = 0.428 |
| 2022 | 11 | 2022/11/1 | Y | 11 | |
| 2022 | 11 | 2022/11/1 | N | 30 | (30)/(11+30) = 0731 |