I want to be able to obtain the fraction on the right most column.
Company | Late? (boolean) | count of jobs | total jobs by company | fraction |
---|---|---|---|---|
A | 1 | 5 | 12 | 5/12 |
A | 0 | 7 | 12 | 7/12 |
B | 1 | 9 | 15 | 9/15 |
B | 0 | 6 | 15 | 6/15 |
B | 1 | 5 | 8 | 5/8 |
B | 0 | 3 | 8 | 3/8 |
This is what I am using right now for the two previous columns.
count of jobs
distinct_count({Job_IDs}, [{company},{Late?}])
total jobs by company
distinct_count({Job_IDs},[{company}])
I just divide the count of jobs by the total number of jobs by company but qs is not letting me because my numerator and denominator have different levels of aggregation.