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
power-bi-noob
Helper I
Helper I

Get same results in Power BI as Microsoft Access

I have 3 tables: courses_dim, enrollments_dim, and users_dim.

courses_dim & users_dim are related by enrollments:

powerbinoob_0-1667329659746.png

I am attempting to create a table that shows how many courses each instructor has.

I added the instructor's name and a measure of Courses Per Instructor = COUNTROWS(course_dim). Additionally, I added a filter for the enrollment type of "TeacherEnrollment", which should remove all student names. However, this filter DOES NOT remove the students, they still show up in the list.

Here is the table that shows my results in PowerBI. Notice Courses Per Instructor shows the sum of all courses in the system as opposed to the actual courses per instructor. Note: I have filtered this also based on name (Contains Demo) to remove any personal identifying information:

powerbinoob_1-1667330006824.png

Here are the results if I try the same thing in Microsoft Access (these results are correct):

powerbinoob_2-1667330025605.png

This is the visual design of the query in Access:

powerbinoob_3-1667330045158.png

 

Here is the SQL query:

SELECT User_dim.name AS User_dim_name, Count(Course_dim.name) AS Course_dim_name
FROM User_dim INNER JOIN (Course_dim INNER JOIN Enrollment_dim ON Course_dim.[id] = Enrollment_dim.[course_id]) ON User_dim.[id] = Enrollment_dim.[user_id]
GROUP BY User_dim.name, Enrollment_dim.type
HAVING (((User_dim.name) Like "*demo*") AND ((Enrollment_dim.type) Like "*teacher*"));

 

How can I recreate this result in PowerBI?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@power-bi-noob , Try a measure like

 

Count(Enrollment_dim[course_id])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@power-bi-noob , Try a measure like

 

Count(Enrollment_dim[course_id])

That worked! Thanks @amitchandak !

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.