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
BPNJMC
Frequent Visitor

Power BI DAX Functions not Working Because of Star Schema Relationships

I've been trying to create my first star schema based on Google Classroom data for a week.  

 

I’ve spent countless hours of Googling sites/pages like these and others:

https://docs.microsoft.com/en-us/power-bi/guidance/star-schema 

https://exceleratorbi.com.au/the-optimal-shape-for-power-pivot-data/

https://radacad.com/power-bi-basics-of-modeling-star-schema-and-how-to-build-it 

 

Here is a picture of my latest attempt:

 

Star Schema Attempt (1).jpg

 

 

 

I have a table visual that shows CourseName, StudentsEnrolled (it works)

StudentsEnrolled = CALCULATE(DISTINCTCOUNT(gc_FactSubmissions[StudentUserID]))

 

I am trying to create a table visual that shows StudentFullName, CourseWorkTitle, PointsEarned, MarkPct.

MarkPct = divide(sum(gc_FactSubmissions[SubmissionAssignedGrade]),sum(gc_DimCourseWork[MaxPoints]))

 

When I try to add StudentName to the visual, I end up with incorrect results (some blank student names and incorrect totals).

 

When I try to use DAX Related() to add StudentName, I can only select fields in the Submissions table.  From my reading, this means that there is a problem with my relationships.

 

I think the problem might be the gc_DimStudents table because it contains a student record for every student that is enrolled in gc_DimCourses.  Not all students enrolled have submitted assignments, so if I limited the gc_DimStudents to only the StudentUserIDs in gc_FactSubmissions, then I won’t be able to get a count of StudentsEnrolled in courses.

 

I’m not sure how to resolve this. Should I make gc_DimCourses into a 2nd fact table? Do I need two student tables, like gc_DimCourseStudents and a gc_DimSubmissionStudents?  

 

I want to keep building on one star schema model because we want reports/dashboards that relate things like online marks, to attendance, to disciplinary actions, etc., etc. So I want to get the relationships correct this time.

 

Any help is very appreciated.

Thanks, JMC

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @BPNJMC,

I agree with Greg_Deckler, it probability related to your relationship directions. You can check the below blog to know more about relationship directions.

What is the Direction of Relationship in Power BI? 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

@BPNJMC Try changing your relationship directions to Both?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.