Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
jernau
Regular 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.

 

There are two task types: 'Task', and 'Parent Task'.  Every 'Parent Task' has one 'Task'.

 

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 NumberTaskDurationParentTaskDesired Duration Measure Output (average duration)
MCN51T10P11
MCN51T20P23
MCN51P11<blank><blank> or 0
MCN51P23<blank><blank> or 0
Total  4 2

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @jernau,

 

Please try the formula below.

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

Measure_to_average_duration_in_related_rows

 

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.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @jernau,

 

Please try the formula below.

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

Measure_to_average_duration_in_related_rows

 

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.

That worked really well, thank you Dale!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.