cancel
Showing results for
Did you mean:
Frequent Visitor

Measure to average duration in related rows

Hello,

I want to create a measure which will calculate the average duration of task(s) completed by a machine.

All of the data I require is held against the 'Task', except for one column which is recorded against the 'Parent Task'.

What I want to achieve, looks like this (the right-most column); can anyone suggest how to do this?

 Machine Number Task Duration ParentTask Desired Duration Measure Output (average duration) MCN51 T1 0 P1 1 MCN51 T2 0 P2 3 MCN51 P1 1 or 0 MCN51 P2 3 or 0 Total 4 2

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft

Re: Measure to average duration in related rows

Hi @jernau,

```Measure 2 =
AVERAGEX (
'Table1',
CALCULATE (
AVERAGE ( Table1[Duration] ),
FILTER ( ALL ( Table1 ), Table1[Task] = EARLIER ( Table1[ParentTask] ) )
)
)
```

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Microsoft

Re: Measure to average duration in related rows

Hi @jernau,

```Measure 2 =
AVERAGEX (
'Table1',
CALCULATE (
AVERAGE ( Table1[Duration] ),
FILTER ( ALL ( Table1 ), Table1[Task] = EARLIER ( Table1[ParentTask] ) )
)
)
```

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Measure to average duration in related rows

That worked really well, thank you Dale!

Announcements