Reply
power-bi-noob
Helper I
Helper I
Partially syndicated - Outbound

Get count of assignments in courses

I have two tables (courses, assignments) that are related by the course id. I can easily create a table showing a list of courses and all of the assignments in each course. What I'd really like to do is have a table that shows the number of assignments in each course.

 

So instead of:

course 1, assignment 1

course 1, assignment 2

course 1, assignment 3

course 1, assignment 4

course 2, assignment 1

course 2, assignment 1

 

I'd like:

course 1, 4

course 2, 2

 

What sort of DAX magic would I need to make this happen? Thanks!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Syndicated - Outbound

Create a measure like

Num assignments = COUNTROWS(Assignments)

and add that to a visual with the course name column from the courses table.

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Syndicated - Outbound

Create a measure like

Num assignments = COUNTROWS(Assignments)

and add that to a visual with the course name column from the courses table.

Syndicated - Outbound

All that does is add a 1 at the end of each assignment, so now I get:

course 1, assignment 1, 1

course 1, assignment 2, 1

course 1, assignment 3, 1

course 1, assignment 4, 1

course 2, assignment 1, 1

course 2, assignment 1, 1

Syndicated - Outbound

remove the assignment name column from the table visual

Syndicated - Outbound

I actually just figured that out a split second after my post. Thanks!

 

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)