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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
gabrielkvd96
Frequent Visitor

Calculate average datediff between two process steps

Hello Power-BI community, 

 

I have an issue where I try to calculate the average leadtime between two process steps(Out on Auction -> Buy-Option) within our workflow. The issue occurs whenever the datediff between two process steps are in two different months. In this case, I would like to always refer the datediff average to the latest date/month which the lastest process step occured,  which in this case is "Buy-Option". Here is the outcome of the DAX I have tried, but for Object Number 7131842 the datediff cannot be placed in Year-Month 202212 which object number 7131905 can since the two process steps occured in the same month. See sample date below:

 

Object NumberProcess stepProcess Date
7131842Out On Auction2022-10-26
7131842Buy-Option2022-12-08
7131905Out On Auction2022-12-07
7131905Buy-Option2022-12-12

 

My Expected Outcome would like to be:

 

Object NumberAverage LeadtimeYear - Month
713184243202212
71319055202212


RELATIONS:

gabrielkvd96_0-1681823387773.png

 

 

Here is the DAX im using at the moment:

Out on Auction -> Buy-Option =

AVERAGEX(

KEEPFILTERS(VALUES('Dim Vehicle Details'[Object Number])),

CALCULATE(

IFERROR(

DATEDIFF(

(CALCULATE(MAX(Process[Process Date]), 'Dim Process Step'[Process Step]="Out On Auction")),

(CALCULATE(MAX(Process[Process Date]), 'Dim Process Step'[Process Step]="Buy-Option")),

DAY),

"")

)
)
 
This is my outcome by using the DAX above:
gabrielkvd96_0-1682001211935.png

 

 

2 REPLIES 2
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hi Ibdenlin, 

 

Thank you for the reminder! 

Please see updated post.

 

Thank you!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.

Users online (290)