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
TIGER8855
Helper I
Helper I

Average for amount of days open on tasks

I need to create a measure showing the average days open for tasks over the last 5 years at monthly intervals. The tasks can have a start date and an end date. At any given month, I need to measure how many days a task has been open and if a task has been closed, how long the task took and then add them all together and work out the average (if the start date is blank, this should be disregarded). 

 

Below is a table with sample data and then the last 2 columns show what I would expect the count to be on the 1st Jan of that year and then what the average should be.

 

IDStart             End               1-Jan-18   1-Jan-19   
242-Mar-173-Sep-20305670
2726-Apr-17 250615
21    
522-Nov-1728-Jan-2040395
105-Feb-188-Aug-22198.33330
422-Feb-1829-Oct-20 313
614-Mar-1816-Jan-22 293
2518-Mar-1818-Aug-20 289
328-Mar-188-May-18 41
1111-Apr-18  265
348-May-18  238
930-May-18  216
1315-Oct-18  78
2122-Oct-18  71
3322-Oct-18  71
378-Nov-18  54
1712-Nov-181-Oct-119 50
3114-Nov-18  48
1821-Nov-1824-Sep-20 41
1219-Dec-1823-Nov-19 13
    215.32

 

3 REPLIES 3
TIGER8855
Helper I
Helper I

Is anyone able to assist with my query?

amitchandak
Super User
Super User

@TIGER8855 , Open date using a date table not joined with task table

A measure like

 

Averagex(Values(Task[ID]) , Switch(True() ,

isblank(Max(Table[End Date])) , datediff(Min(Table[Start Date]), max(date[Date]) , day) ,

Max(Table[End Date]) <max(date[Date]), blank() ,

datediff(Min(Table[Start Date]), Min( max(date[Date]) , Max(Table[End Date]) ) , day)

)

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

@amitchandak when using this measure, the output is only calculating the days open for the first entry (ID 24 which has the earliest start date).

So the value on the 1-Jan-18 is 305 and on the 1-Jan-19 it's 670.

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