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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Date difference between rows

Yo everyone, how are you doing :)?

I am trying to measure avg duration between different stages at my work flow.

Im using salesforce field history data and the table build like that:

taltul321_0-1643118860659.png

I Would like to find the avg duration of each ParentID(foregin key) and between specific stages. for example:

Whats the datediff between

Created date of ParentID = a2p..... ,oldValue = New, NewValue = Assignted &
Created date of ParentID = a2p..... ,oldValue = Assignted, NewValue = In progress.

 

What ive done so far:

Measure #1 =
var Type1 = CALCULATE(max('History: Work'[CreatedDate]),'History: Work'[OldValue] = "New",'History: Work'[NewValue] = "Assignted",'History: Work'[Work.agf__Type__c] = "User Story")
var Type2 = CALCULATE(max('History: Work'[CreatedDate]),'History: Work'[OldValue] = "Assignted",'History: Work'[NewValue] = " In Progress",'History: Work'[Work.agf__Type__c] = "User Story")
return
DATEDIFF(TYPE1,TYPE2,DAY)
 
Unfortunatly, I cant calculate the Average duration in that way.
 
Any suggestions?

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

Try createing an average measure like this.

Average Measure = AVERAGEX ( VALUES ( 'History: Work'[ParentID] ), [Measure #1] )

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@jdbuchanan71 Thank you so much dude! it worked 🙂

jdbuchanan71
Super User
Super User

@Anonymous 

Try createing an average measure like this.

Average Measure = AVERAGEX ( VALUES ( 'History: Work'[ParentID] ), [Measure #1] )

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.