After further investigation, here is a solution to count results using two queries:
[
{
"from": "Scope",
"select":["Workitems:Story[AssetState!='Dead'].@Count"],
"filter":["ID='Scope:0'"]
},
{
"from": "Story",
"select": ["Name"],
"filter":["Scope='Scope:0'","AssetState!='Dead'"],
"page":
{
"start":0,
"size":200
}
}
]
Some clarification on line 4:
"select":["Workitems:Story[AssetState!='Dead'].@Count"]
After "Workitems" we are down-casting the collection to "Story", and then filtering where the "AssetState" isn't "Dead" to get active stories and finally counting Workitems.
Here you will find some references and extra documentation: