Search code examples
wiql

In a TFS 2010 Work Item Query can I add two field values as the "Value"?


I would like to create a team query for our TFS users that shows all task items where the sum of the [hours remaining] and [hours completed] fields exceed the [original estimate] value.

Now Whilst I can add a clause to the WIQL that compares one field to the value of ONE other field (Which I had to ask you kind folks in stack exchange how to do in How do I write a TFS 2010 Work Item query clause whose value is a field value? which was answered by PVitt with admirable politeness - Since I had simply failed to read the "operator" drop down properly!)

I am struggling to find a way of querying the sum of two fields.

For example:

This query clause works;

And Completed Work > [Field] Remaining Work

What I really want is something along the lines of;

And Completed Work > [Field] Remaining Work+Original Estimate

The problem is either this cannot be done, or my wild guesses as to the correct syntax for summing two field values have all been wrong.

Specifying two filenames separated with a + just yields a TF51005 error TF51005 dialog

Similarly guessing at a "macro" like Sum(Remaining Work+Original Estimate) or Sum(Remaining Work,Original Estimate) results in the same.

So is this even possible? if it is how would I go about this?


Solution

  • What you want is not possible. Your options are to use: 1) the object model to write C# code that iterates over the work items from a query and do the math yourself 2) run the query in excel and do the calculations and filter in excel 3) use ssrs to create a report that does the math for you

    If you think this is important, you can always post your suggestion on user voice: https://visualstudio.uservoice.com