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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Average between dates

Hello!

I am calculating the average between 2 dates (application start date and closing date). Create a column to calculate the duration with the following formula: Duration = DATEDIFF('Table'[Start Date],'Table'[Dated],DAY)

LuisaF1126_0-1631115023999.pngLuisaF1126_1-1631115052650.pngLuisaF1126_2-1631115072697.png

The problem is that there are cases that are still open and do not have a closing date, therefore they are blank. But when calculating the averages with the function Average Attention Span (Days) = AVERAGE('Table'[Duration])

It is resulting in a value much higher than the real average.
LuisaF1126_3-1631115111458.pngEI calculated the value manually and it gives me 14.83.

How can I solve this?

Thanks for the help.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Assuming Duration is a calculated column formula, edit the formula to:

Duration = if(isblank(Table[dated]),blank(),DATEDIFF('Table'[Start Date],'Table'[Dated],DAY))

The average should not be correct.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Assuming Duration is a calculated column formula, edit the formula to:

Duration = if(isblank(Table[dated]),blank(),DATEDIFF('Table'[Start Date],'Table'[Dated],DAY))

The average should not be correct.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

You can solve this by defining what should happen in such a case - should the data be excluded, or should the missing Close Date be substituted with "today"?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.