Write a WIQL query to get number of days a bug is open

509 Views Asked by At

I am trying to create a query using WIQL which later I am opening in TFS. I want a field in my bug report that shows for how many days a bug is open. Below is the query:

<?xml version="1.0" encoding="utf-8"?>
<WorkItemQuery Version="1"><Wiql>
SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State],@today-[System.CreatedDate] as 'Days' FROM WorkItems 
WHERE [System.TeamProject] = @project  AND  [System.WorkItemType] = 'Bug' 
 </Wiql>
 </WorkItemQuery>

When I am opening this .txt file in Visual studio as a query it is showing me an error saying 'The query statement is missing a FROM clause'.

Am I writing the correct query? Or is there anything I should update so that the query works fine and it gives me number of days a bug is open as a field in my Bug summary.

Thanks in advance.

1

There are 1 best solutions below

1
Shamrai Aleksander On

Azure DevOps Server (TFS) does not support calculated fields or calculated query columns. You can try to use:

  1. Excel with formulas: Add or modify Azure Boards work items in bulk with Microsoft Excel
  2. Powers BI reports: Calculate time-in-state for an existing Analytics view