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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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

Then, return only

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

View solution in original post

3 REPLIES 3
mlsx4
Super User
Super User

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 

 

Then, return only

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.