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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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 is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.