I have the following table (I have covered up the current_holder column for privacy reasons):
For each row, I want to find the number of times we could pull 4 unique objects out of a bag (the objects being keys, skulls, gems, coins, daggers and crowns) without return. For example, in row 1 I could do this 6 times since once all of the skulls are taken out there are now only 3 unique objects left in the bag. For row 2 there is no way of pulling out 4 unique objects. For row 3 I could do this 5 times since after all the skulls are taken out there would still be one more combination of 4 unique objects left.
Does anyone know how I could calculate this number in BigQuery?