cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jernau Frequent Visitor
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.

 

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

Accepted Solutions
v-jiascu-msft Super Contributor
Super Contributor

Re: Measure to average duration in related rows

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 Super Contributor
Super Contributor

Re: Measure to average duration in related rows

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

jernau Frequent Visitor
Frequent Visitor

Re: Measure to average duration in related rows

That worked really well, thank you Dale!

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 144 members 1,613 guests
Please welcome our newest community members: