SSAS Tabular Model - Analyze Students without Assigned Grades

libpekin 166 Reputation points
2023-08-02T01:33:23.1833333+00:00

Hello,

Need help with an SSAS Tabular model. My requirements are to analyze students with grades and those without.

The model has the following tables.

  • a Grades Fact table
  • a Courses Bridge table and
  • a Students Dimension table

Relationship: Fact has many-to-many relationship with the Courses, and Students can be enrolled in one-to-many courses.

Today I can analyze my data by Students with grades, but I also want to be able to analyze the data by Students without grades.

Thanks,

Francis

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,338 questions
0 comments No comments
{count} vote

Accepted answer
  1. Amira Bedhiafi 31,391 Reputation points
    2023-08-02T09:23:37.1266667+00:00

    Hello Francis,

    The issue you're experiencing is common when dealing with data analysis tasks. When we are analyzing "presence" data (in your case, students with grades), it's often easy to overlook "absence" data (students without grades). Fortunately, you can solve this problem by manipulating the data or creating calculated tables or columns.

    Create a separate calculated table for all students. This can be achieved with a DAX formula such as:

    AllStudents = DISTINCT('Students'[StudentID])

    Create a calculated column in the new AllStudents table to check if each student has any grades. This can be done with the following DAX:

    HasGrades = IF(

    CALCULATE(
    
        COUNTROWS('Grades'),
    
        FILTER(
    
            'Grades',
    
            'Grades'[StudentID] = 'AllStudents'[StudentID]
    
        )
    
    ) > 0,
    
    "Yes",
    
    "No"
    

    )

    Now, you can use the new AllStudents table for your analysis. Students with 'HasGrades' = "Yes" have at least one grade, and students with 'HasGrades' = "No" do not have any grades.

    Remember, this model requires that you have a 'StudentID' column in both the 'Students' and 'Grades' tables.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. libpekin 166 Reputation points
    2023-08-02T22:21:02.7733333+00:00

    Thank you, Amira.

    Got the approach implemented and it seems to be working, but for some reason the "No" counts are not being displayed in the UI. Any thoughts?

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.