Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi Community -
I'm trying to get the count of bugs that were found by a client. There is a boolean field (Custom_FoundByClient) to be true when this is the case. I'm not sure how to specify it to only filter for Custom_FoundByClient = true or false. My snippet is below.
Thanks!
let
Source = OData.Feed("xxx"
&"$filter=WorkItemType eq 'Feature'"
&" and State ne 'Cut'"
&" and Descendants/any()"
&"& $select=WorkItemId,Title,WorkItemType,State,Custom_EstimateCompleted,Custom_EstimateType"
&"& $expand=AssignedTo($select=UserName),Iteration($select=IterationPath),"
&"Descendants("
&"$apply=filter(WorkItemType eq 'Bug')"
&"/aggregate($count as CountBugs, Custom_FoundByClient with countdistinct as FoundByClientCount)"
&"),
",
null, [Implementation="2.0",OmitValues = ODataOmitValues.Nulls,ODataVersion = 4]),
#"Expanded Descendants" = Table.ExpandTableColumn(Source, "Descendants", {"CountBugs", "FoundByClientCount"}, {"Descendants.CountBugs", "Descendants.FoundByClientCount"})
in
#"Expanded Descendants"
Solved! Go to Solution.
Ok, here you go. I think this will work. See this PBIX file. But here is what I did:
You can see the full M code in the PBIX linked to above.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCould you provide some sample data? We don't have access to your ODATA feed, so I don't know what you are looking at or what your code is acting upon.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingSure thing
Feature Table
ID | Type | FeatureName |
1 | Feature | Name 1 |
2 | Feature | Name 2 |
Bug Table
ID | Type | Feature ID | Bug Name | FoundByClient |
1 | Bug | 1 | Big Bug | True |
2 | Bug | 1 | Medium Bug | True |
3 | Bug | 1 | Small Bug | False |
I'm already able to roll up the bugs per feature but I need to count it based on FoundByClient. In the example above. I want the query to provide me with BugsFoundByClient count as 2.
Result
ID | Type | Feature Name | FoundByClientCount | FoundByInternalCount |
1 | Feature | Name 1 | 2 | 1 |
2 | Feature | Name 2 | 0 | 0 |
Thanks @edhans
Ok, here you go. I think this will work. See this PBIX file. But here is what I did:
You can see the full M code in the PBIX linked to above.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingAwesome! I dug around and I was able to also get the count by casting the value.
&"/aggregate($count as CountBugs, cast(Custom_FoundByClient eq true, Edm.Int32) with sum as FoundByClient, cast(Custom_FoundByClient eq null or Custom_FoundByClient eq false, Edm.Int32) with sum as FoundByInternal)"
Excellent! yeah, if you can find away to get the server to do the work for you, that is always the best method.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting