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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
xliu1
Helper II
Helper II

Conditional count for a category column

I am very new to Power BI. I try to do a conditional count for a category column, and here is my syntax. COURSE_MODALITY is the table, and GRADE_AWARDED is the column. I want to count number of grades in all those categories. I get this error message: too many arguements were passed to the RELATED function. The maximum argument count for the function is 1. How should I modify the syntax? Thanks!

DF Grades = COUNTAX(FILTER(COURSE_MODALITY,RELATED([GRADE_AWARDED] IN {"D","D+","D-","F","U"},)))

 

 

1 ACCEPTED SOLUTION
pranit828
Community Champion
Community Champion

Hi @xliu1 

 

DF Grades = calculate(COUNT(COURSE_MODALITY[GRADE_AWARDED]),COURSE_MODALITY[GRADE_AWARDED] IN {"D","D+","D-","F","U"})


Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

3 REPLIES 3
pranit828
Community Champion
Community Champion

Hi @xliu1 

 

DF Grades = calculate(COUNT(COURSE_MODALITY[GRADE_AWARDED]),COURSE_MODALITY[GRADE_AWARDED] IN {"D","D+","D-","F","U"})


Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
amitchandak
Super User
Super User

@xliu1 , try like

DF Grades = COUNTAX(FILTER(COURSE_MODALITY,RELATED([GRADE_AWARDED]) IN {"D","D+","D-","F","U"}))

or

DF Grades = countrows(FILTER(COURSE_MODALITY,RELATED([GRADE_AWARDED]) IN {"D","D+","D-","F","U"}))

Hi @amitchandak thanks for your prompt response. I tried both syntaxes. The first one still gives me the same error message. The 2nd one gives me the message: function RELATED expects a fully qualified column reference as its argument. Any idea? Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.