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
Syndicate_Admin
Administrator
Administrator

AVERAGE OF A MEASUREMENT (TIME ELAPSED IN WEEKS)

I need to calculate the average of a measure that calculates the difference in weeks between two dates. The problem is that the start date and end date are in the same column that is, I have more than one record and what I do to calculate the number of weeks elapsed is to take the maximum for that record the minimum for that record and then subtract them, the number of elapsed weeks is calculated perfect, But now I'm trying to calculate the average of that measure and I can't figure it out.

CategoryRegistration Date
Registration ADate 1
Registration ADate 2
Registration ADate 3

My measurement does the following QTY Weeks = DATEDIFF(min(DateRecord]),max([DateRecord]),WEEK)

What I want to calculate is AVERAGE(QTY Weeks)

Thank you!

1 ACCEPTED SOLUTION
campelliann
Post Patron
Post Patron

Hello, try this measure:

AVERAGEX(ADDCOLUMNS(VALUES(Table1[Regist]),"@datediff",DATEDIFF(CALCULATE(MIN(Table1[Date])),CALCULATE(Max(Table1[Date])),WEEK)),[@datediff])

 

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Thank you very much Perfect work!

Thank you :). Could you please accept this as solution. Best regards.
 BTW, you dont actually need the addcolumns, although is more intuitive. You can just do the averagex (Values,expression)

campelliann
Post Patron
Post Patron

Hello, try this measure:

AVERAGEX(ADDCOLUMNS(VALUES(Table1[Regist]),"@datediff",DATEDIFF(CALCULATE(MIN(Table1[Date])),CALCULATE(Max(Table1[Date])),WEEK)),[@datediff])

 

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