Average of the custom value of subtasks for parent row

I have a lil issue with a eazyBi report.
I have a report with rows of task with its subtasks.
Now, each subtask has a custom value, now what i would like to do is:
for the row of subtask: custom value is shown
for the row of task: average of custom value of each subtasks is shown.

my solution:
case when issuetype = ‘subtask’
then [measures].[custom value]
case when issuetype = ‘task’
then avg(descendants([issue].currentMember, [issue].[issue]), [measures].[custom value])

the problem here arises is each task has same value.

Another question: is there any way to show average of all the tasks at top of chart?

Any suggestions/comments would be appreciated.