I have a use case where I would like to be able to do a SUM over a field but only include a reading if it has a reading in another field. More specifically, given the screenshot below, I would like to be able to make a query that adds 2 additional fields to the output (ColZ_BasedOnColX and ColZ_BasedOnColY). The ColZ_BasedOnColX field must contain a SUM of the readings in ColZ for which we have a corresponding reading in ColX. So, in this case ColZ_BasedOnColX should get the value 101.2 (10+6+2+32.6+2+32.6+10+6). Similarly, ColZ_BasedOnColY should get the value 105.2 because ColY also has readings in row 3 and 9.
Is this somehow possible?. I know this can be done by creating the 2 fields and and only insert a reading if the associated field has a value. However, this will take up quite a lot of disk space so I would much rather do it a run-time. Any suggestions?