How to treat an empty dataset as zero for sum() in Expression

After upgrading from 7.9.3 to 7.9.18, I’ve been seeing some errors in our Expression code.
“Error evaluating tag: Expression left operand is null.”

We have a UDT with several query tags, sometimes there are no rows in the dataset.
In an expression tag we have:

sum({[.]SQLVolumeDS}, "converted_value")
+
sum({[.]SQLDilutionsVolDS}, "converted_value")
+
sum({[.]SQLTranserVolDS}, "converted_value")

I tried adding error handling but try(sum()) still returns null instead of zero, causing an error:

try(sum({[.]SQLVolumeDS}, "converted_value"), 0)
+
try(sum({[.]SQLDilutionsVolDS}, "converted_value"), 0)
+
try(sum({[.]SQLTranserVolDS}, "converted_value"), 0)

Any suggestions for getting this tag to calculate the total, even if any one of the datasets are empty?

Try this

try(sum({[.]SQLVolumeDS}, "converted_value"), 0) +
try(sum({[.]SQLDilutionsVolDS}, "converted_value"), 0) +
try(sum({[.]SQLTranserVolDS}, "converted_value"), 0)

I recall getting that error on upgrade too and I think this was the fix.

I still get the same error message

You could use coalesce, that returns the first non null value.
If sum({empty dataset}) returns null, then you could do
coalesce(sum({dataset1}), 0) + coalesce(sum({dataset2}), 0) + ...

That worked, thanks!