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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors