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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Find if True Value Exists for Each ID and Add 1

I have a table with data that looks like this:

Untitled.png

What I would like to do is for each ID, I want to see if there is a trainer attached to it, as shown by a true value in the isTrainer column, and then add 1 to a count. For example, for the ID ending in 7380, there exists a true value, so 1 should be added to the count. For the ID ending in 9910, there are multiple true values, but still just 1 should be added to the count. If there are only false values for an ID, then the count should not be incremented.

 

Thnks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous 

Try Like

countx(filter(summarize(Table, Table[ID], "_1",countx(filter(Table,Table[Istrainer]="Y"),Table[ID])),[_1]>=1),[ID])

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

View solution in original post

2 REPLIES 2
jstorm
Resolver III
Resolver III

This can be done in the 'Transform Data' window using a calculated column.  You will need Table.Distinct and Table.Contains in M Query.

If you do not want to work through the logic yourself, you can use 'Add Column from Example' to have Power BI determine the logic for you.

https://docs.microsoft.com/en-us/power-bi/desktop-add-column-from-example

 

 

amitchandak
Super User
Super User

@Anonymous 

Try Like

countx(filter(summarize(Table, Table[ID], "_1",countx(filter(Table,Table[Istrainer]="Y"),Table[ID])),[_1]>=1),[ID])

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors