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.
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.