Hello @ced2flux,
Welcome! That’s exciting that you’re using reduce()!
I think this thread would be useful to you:
Also you might be able to do this without reduce?
Let me know if these resources help. Can you provide a little bit of annotated csv of your data before the transformation and your expected result for me to try and write the query?