I need to add a filed to work item that count number of changes in a another filed, let say I have a filed called EndDate so I need a way to calculate how many times this filed is changed and present it as filed EndDateChangeCount in order to query based on it
The default work item rules do not support count the number of times based on any another work item field be changed.
For this scenario, you can submit it as a suggestion here. Our PM will kindly review any suggestion.
As a workaround, if your company has the Analytics Services turned on and available to users, then you could use Excel's Power Pivot tools to query the cube directly.
NOTE: The TFS Warehouse and Analytics Cube haven't seen major updates since their introduction in 2010 and are being replaced by the new OData based Analytics Service in Azure Devops. A sample for your reference:
SELECT [WorkItemSK]
,[WorkItem]
,[System_Id]
,[System_Title]
,[System_State]
,[System_Rev]
,[System_ChangedBy]
,[System_Reason]
FROM [Tfs_Warehouse].[dbo].[WorkItemHistoryView]
where
System_Id = 24 --This is the ID from TFS for the WIT
and xxx
Another way you can use the REST API or Client API to get all revisions of a work item. Iterate over the revisions and check whether the EndDate field has been changed.