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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Chelly
Frequent Visitor

Creating a Measure for Counting and Filtering

Hello,

I would like to inquire about creating a measure in Power BI that allows me to identify students who have had two opportunities. I have a table called "PRO" which includes a column called "idStd" that contains the student IDs. Additionally, I have another table called "Opp" idopp" that may have duplicate values if a student has multiple opportunities. My goal is to create a measure that, when applied to a table visual, displays  the count of opportunities equal to 2 along with the list of students .

Currently, I have achieved this by applying a filter directly to the table visual, where I select the Opp"idStd" column, choose the "equal to" condition, and enter the value "2". However, I would like to convert this into a measure instead.

Thank you for your assistance.

1 ACCEPTED SOLUTION
mlsx4
Memorable Member
Memorable Member

Then, return only

IF(opport=2,opport,blank())

View solution in original post

3 REPLIES 3
mlsx4
Memorable Member
Memorable Member

Hi @Chelly 

 

Have you related both tables by IdStd?

mlsx4_0-1689677998786.png

 

If it is the case, you just need to countrows in the Opp table

 

Num Opp = COUNTROWS(Opp)

 

and display the measure along with the list of students

mlsx4_1-1689678110600.png

 

P.S. If you want to display all the list but with a zero value for the ones that don't have any, use:

Num Opp = 
var opport= COUNTROWS(Opp)

return IF(opport=0,0,opport)

and you will get:

mlsx4_2-1689678249445.png

 

 

Chelly
Frequent Visitor

Thanks, but i need to return student who have only 2 

 

mlsx4
Memorable Member
Memorable Member

Then, return only

IF(opport=2,opport,blank())

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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