Your code would calculate the difference between two dates only at issue level as it is using two properties imported as custom fields.
If you would like to calculate the average result from all issues (for the given report context), you would need to create a new calculated measure that would iterate through issue-level and calculate the average results from these differences.