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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Pandadev
Post Prodigy
Post Prodigy

Get Average of days for each ID that has been changed based on date_created

Hi I am trying to find a way to get an average of how long it takes to change data for each ID code in a large data set.

An example for ID 026A is as follows , it was created on 01/01/2020

01/01/2020

24/01/2020 23 days between updates

02/02/2020 9 days between updates

15/03/2020 42 days between updates

30/04/2020 46 days between updates

 

Average is 24 days between updates

 

I would then Like to be able to get the average of all the averages for each ID code.

Is this possible in PowerBI

4 REPLIES 4
amitchandak
Super User
Super User

@Pandadev 

New column like

last_date = datediff(maxx(filter(table,[ID]=earlier([ID]) && [Date]<earlier([Date])),[Date]),[Date],day)

 

This measure can also give the last date and then you can take diff. View by ID, Date Calendar has been used

Last Day Non Continous = CALCULATE(Max('Table'[Date]),filter(all(Table),Table[Date] =MAXX(FILTER(all(Table),Table[Date]<max(Table[Date])),Table[Date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I am getting an error saying Date Created cannot be found or cannot be used in this expression , when adding the measure.

 

The column formula worked , but it does not seem to give the correct values , does it take into account dividing by how many ID's there are to get the average date diff

Hi @Pandadev ,

The calculated column like @amitchandak  created will get the right datediff and you can create an average measure to calculate average datediff based on each ID:

Average =
CALCULATE (
    DIVIDE ( SUM ( 'Table'[Column] ), COUNTROWS ( 'Table' ), BLANK () ),
    ALLEXCEPT ( 'Table', 'Table'[ID] )
)

The final result will like this:

average result.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

Is it possible if date created = date modified , the the date diff would be date craeted compared to todays date , as otherwise the value is zero

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors