Azure-devops-docs: Descendants(any) does not return features with no stories as stated in documentation

Created on 19 Feb 2020  路  3Comments  路  Source: MicrosoftDocs/azure-devops-docs

The query breakdown table (https://docs.microsoft.com/en-us/azure/devops/report/powerbi/sample-boards-featureprogress?view=azure-devops&tabs=powerbi#query-breakdown) states that descendants(any) means that, in the example, any features without stories will be returned. I've tried your example against my org/project and it doesn't do that. It would seem the aggregation / filtering on the descendants only returns parent features for which there are children. Interestingly the query does return a feature that has bugs but no stories, but it isn't returning features that have no children at all.

Documentation could be updated to reflect that (it's misleading at the moment) if it's not a bug.

https://docs.microsoft.com/en-us/azure/devops/report/powerbi/sample-boards-featureprogress?view=azure-devops&tabs=powerbi

Pri3 doc-bug

All 3 comments

Thanks @drmexico . It seems to be a typo in the docs. Descendants/any() filters out any work item that has at least one (or "any") descendant. To get all work items with their descendants even if they don't have any, you can just run a query without Descendants/any() filter. A general template for it (for verification purposes is below)

For all workitems with and without descendants
https://analytics.dev.azure.com/{Organization}/{Project}/_odata/v3.0-preview/WorkItems?$filter=endswith(Area/AreaPath,'suffix')&$select=WorkItemId,Title,WorkItemType,State,Area, Descendants&$expand=Descendants($select=WorkItemId)

For all workitems with atleast one descendant
https://analytics.dev.azure.com/{Organization}/{Project}/_odata/v3.0-preview/WorkItems?$filter=endswith(Area/AreaPath, 'suffix')and Descendants/any()&$select=WorkItemId,Title,WorkItemType,State,Area, Descendants&$expand=Descendants($select=WorkItemId)

The specific query in the doc can be corrected to
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v3.0-preview/WorkItems?"
&"$filter=WorkItemType eq 'Feature' "
&"and State ne 'Cut' "
&"and startswith(Area/AreaPath,'{areapath}') "
&"&$select=WorkItemId,Title,WorkItemType,State,AreaSK "
&"&$expand=Descendants( "
&"$apply=filter(WorkItemType eq 'User Story') "
&"/groupby((StateCategory), "
&"aggregate(StoryPoints with sum as TotalStoryPoints)) "
&") "
,null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4])
in
Source

Thanks for clarifying @ksmis-gh and supplying the other examples, really helpful.

Updating article with more examples.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sevaa picture sevaa  路  3Comments

KacperMucha picture KacperMucha  路  3Comments

dannyvv picture dannyvv  路  3Comments

o-o00o-o picture o-o00o-o  路  3Comments

csutorasr picture csutorasr  路  3Comments