Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
New
New Member

get Count at specific hierarchy/Group level with a condition

HI Guys, 

Want to get the count of rows at specific hierarchy/group level with a condition. Sample data:

 

RowValue
Group1Good
   subGroup1 
       Row1 
       Row2 
Group2Bad
    SubGroup1 
        Row3 
        Row4 
Group3Good
        subGroup1 
        Row5 

 

Need the calculation to get the count of value = 'Good' at the Group level, which  2 in above case. What visual to use to show this single result in a single box?

 

Thank you

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @New 

I suppose "Value" is a measure in matrix visual. Then

Good (Count) =
SUMX ( VALUES ( Table[Group] ), IF ( [Value] = "Good", 1 ) )

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @New ,

Please refer to my pbix file to see if it helps you.

Create a column first.

Column = IF('Table'[Value]="Good",1,BLANK())

Then put the column into a card visual.

vpollymsft_0-1649660319547.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output with a screenshoot.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Super User
Super User

Hi @New 

I suppose "Value" is a measure in matrix visual. Then

Good (Count) =
SUMX ( VALUES ( Table[Group] ), IF ( [Value] = "Good", 1 ) )

Thank you tamerj1, your solution worked.

amitchandak
Super User
Super User

@New , Try a measure like

if(isinscope(Table[Group]), countx(filter(Table, [Value] ="Good"), Table[Group]), blank())

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.