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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
derrickbowen
New Member

How to find the average of a date

We have a business unit that wants us to create a report that aggregates a number of fields, including a couple of milestone dates.  In the excel version of the report that we are basing it from, they just take the average of the dates to show on the aggregate row.  I tried doing the following, but it returns as an Number, which Power BI does not allow you to format as a date:

AVG SC = AVERAGEA('DBOP Pipeline'[SC])

If I put "DATEVALUE()" around the number, it throws an error. 

1 ACCEPTED SOLUTION
derrickbowen
New Member

I figured out how to get around the formatting problem, it's pretty dumb:

 

AVG SC = FIRSTDATE('DBOP Pipeline'[SC])+ INT(AVERAGEA('DBOP Pipeline'[SC]) - FIRSTDATE('DBOP Pipeline'[SC]))

 

Also, I figured out this method for finding the "middle" date:

 

MID SC = FIRSTDATE('DBOP Pipeline'[SC])+ INT( DATEDIFF(FIRSTDATE('DBOP Pipeline'[SC]),LASTDATE('DBOP Pipeline'[SC]),DAY)/2)

 

View solution in original post

1 REPLY 1
derrickbowen
New Member

I figured out how to get around the formatting problem, it's pretty dumb:

 

AVG SC = FIRSTDATE('DBOP Pipeline'[SC])+ INT(AVERAGEA('DBOP Pipeline'[SC]) - FIRSTDATE('DBOP Pipeline'[SC]))

 

Also, I figured out this method for finding the "middle" date:

 

MID SC = FIRSTDATE('DBOP Pipeline'[SC])+ INT( DATEDIFF(FIRSTDATE('DBOP Pipeline'[SC]),LASTDATE('DBOP Pipeline'[SC]),DAY)/2)

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors