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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
michaelwatts80
Regular Visitor

Azure DevOps Time In Board Column

I have pulled data from the WorkItemRevisions table and expanded the BoardLocations table to get all Revisions for WorkItems with the ColumnName from the BoardLocations table. I am trying to calculate the number of Days and Hours a Work Item has been in each ColumnName. 

Data Example:

WorkItemIdColumnRevisionChangedDateChangedDateTime
123456In Development58/2/20248/2/24 11:29 PM
123456In Development48/2/20248/2/24 11:20 PM
123456In Development38/2/20248/2/24 11:19 PM
123456In Development28/2/20248/2/24 11:09 PM
123456In Development18/2/20248/2/24 11:00 PM
123456Ready for Development57/29/20247/29/24 11:29 PM
123456Ready for Development47/29/20247/29/24 11:20 PM
123456Ready for Development37/29/20247/29/24 11:19 PM
123456Ready for Development27/29/20247/29/24 11:09 PM
123456Ready for Development17/29/20247/29/24 11:00 PM


I cannot figure out how to properly calculate for Days and Hours. Any help would be appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @michaelwatts80 , hello, rajendraongole1, thank you for your prompt reply!

Please create two measures as shown below:

TotalTimeInColumnDays = 
   VAR WorkItemId = MAX('Table'[WorkItemId])
   VAR CurrentColumn = SELECTEDVALUE('Table'[Column])
   VAR MinTime =
       CALCULATE(
           MIN('Table'[ChangedDateTime]),
           FILTER(
               ALL('Table'),
               'Table'[WorkItemId] = WorkItemId &&
               'Table'[Column] = CurrentColumn
           )
       )
   VAR MaxTime =
       CALCULATE(
           MAX('Table'[ChangedDateTime]),
           FILTER(
               ALL('Table'),
               'Table'[WorkItemId] = WorkItemId &&
               'Table'[Column] = CurrentColumn
           )
       )
       VAR diff=DATEDIFF(MinTime, MaxTime, SECOND)
   VAR TotalSeconds = diff
   VAR Days = ROUND(DIVIDE(TotalSeconds, 86400), 2)
   RETURN
       Days 
TotalTimeInColumnHours = 
   VAR Hours = [TotalTimeInColumnDays]*24
   RETURN
       Hours 

 Result:

vyajiewanmsft_0-1723014244559.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @michaelwatts80 , hello, rajendraongole1, thank you for your prompt reply!

Please create two measures as shown below:

TotalTimeInColumnDays = 
   VAR WorkItemId = MAX('Table'[WorkItemId])
   VAR CurrentColumn = SELECTEDVALUE('Table'[Column])
   VAR MinTime =
       CALCULATE(
           MIN('Table'[ChangedDateTime]),
           FILTER(
               ALL('Table'),
               'Table'[WorkItemId] = WorkItemId &&
               'Table'[Column] = CurrentColumn
           )
       )
   VAR MaxTime =
       CALCULATE(
           MAX('Table'[ChangedDateTime]),
           FILTER(
               ALL('Table'),
               'Table'[WorkItemId] = WorkItemId &&
               'Table'[Column] = CurrentColumn
           )
       )
       VAR diff=DATEDIFF(MinTime, MaxTime, SECOND)
   VAR TotalSeconds = diff
   VAR Days = ROUND(DIVIDE(TotalSeconds, 86400), 2)
   RETURN
       Days 
TotalTimeInColumnHours = 
   VAR Hours = [TotalTimeInColumnDays]*24
   RETURN
       Hours 

 Result:

vyajiewanmsft_0-1723014244559.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Try using the Time in State for Azure DevOps extension to get Time In Board Column. In addition to calculating cycle time, transition count, status count and more. You can customize your work calendars to suit your needs. And easily export this data. I think you’ll find it helpful.

TIS AZURE GIF..gif





rajendraongole1
Super User
Super User

Hi @michaelwatts80 - create below measure for previous changed date as below:

 

PreviousChangedDateTime =
VAR CurrentWorkItemId = MAX(WorkItemRevisions[WorkItemId])
VAR CurrentRevision = MAX(WorkItemRevisions[Revision])
RETURN
    CALCULATE(
        MAX(WorkItemRevisions[ChangedDateTime]),
        FILTER(
            ALL(WorkItemRevisions),
            WorkItemRevisions[WorkItemId] = CurrentWorkItemId &&
            WorkItemRevisions[Revision] < CurrentRevision
        )
    )
 
 
To calculate Duration in days use below measure:
 
DurationInDays =
VAR CurrentDateTime = MAX(WorkItemRevisions[ChangedDateTime])
VAR PreviousDateTime = [PreviousChangedDateTime]
RETURN
    IF(
        ISBLANK(PreviousDateTime),
        0,
        DATEDIFF(CurrentDateTime,PreviousDateTime , DAY)
    )
 
To get the duration in hours 
DurationInHours =
VAR CurrentDateTime = MAX(WorkItemRevisions[ChangedDateTime])
VAR PreviousDateTime = [PreviousChangedDateTime]
RETURN
    IF(
        ISBLANK(PreviousDateTime),
        0,
        DATEDIFF(CurrentDateTime,PreviousDateTime , HOUR)
    )
 
rajendraongole1_1-1722624043249.png

 

Hope it helps


 

 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors