Query historical data in Azure DevOps

May 13, 2024

If you are using Azure DevOps queries to track work, you might have noticed that there is no direct way to query the historical data from Azure DevOps.

The query results provide the data as of today.

There are cases where we would need to know about the historical data (value of certain fields as on a past date).

Today, we will explore a hidden feature in Azure DevOps that will help us to query historical data.

Create Query:

navigate to Boards → Queries.

Create a simple query as given below

simple query

History Tab:

The only way to know about how a work item evolved is to view the history tab. The history tab of the work item provides good traceability of what has happened with the workitem. However, this option requires us to open each work item to examine the history tab, which may not be a practical solution. Now let's explore an option using Work Item Query Language(WIQL)

Install WIQL extension:

navigate to Organization Settings → Extensions.

install extension

search for wiql and install the below extension

install extension

Edit Query WIQL:

Navigate to the queries screen to see that we have a new option "Edit query wiql"

edit query wiql

once you click on that option, a popup of the query will open

edit query wiql popup

In the query notice that the clauses that we created earlier using the GUI are available in query format.

Add ASOF clause:

Here comes the trick of using ASOF clause to query historical data, add an ASOF clause at the end as shown below

asof clause

click the "save query" button.

The query will display the data of the work item as on the mentioned date, use the "Column options" to introduce the columns you want to view the data for.

Summary:

We learned a simple trick to query historical data from Azure DevOps.

Typical use cases are

  • Finding delta updates (work that happened between a given period)
  • How are work items moved between iterations ?
  • what was the priority of a work item on the said date and how it has changed over time?

Thanks for reading, Goodbye until next week!


Profile picture

Written by Thillai Madhavan who lives and works in India. Stay updated by following him on LinkedIn.

All the information on this website - OrganicDevops.com - is published in good faith and for general information purposes only. OrganicDevops.com does not make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this website (OrganicDevops.com), is strictly at your own risk. OrganicDevops.com will not be liable for any losses and/or damages in connection with the use of our website. From our website, you can visit other websites by following hyperlinks to such external sites. While we strive to provide only quality links to useful and ethical websites, we have no control over the content and nature of these sites. These links to other websites do not imply a recommendation for all the content found on these sites. Site owners and content may change without notice and may occur before we have the opportunity to remove a link that may have gone 'bad'. Please be also aware that when you leave our website, other sites may have different privacy policies and terms which are beyond our control. Please be sure to check the Privacy Policies of these sites as well as their "Terms of Service" before engaging in any business or uploading any information. By using our website, you hereby consent to our disclaimer and agree to its terms. Should we update, amend or make any changes to this document, those changes will be prominently posted here
© 2024, OrganicDevOps