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

Count the number of students each teacher has in a table

Hi Data

My data set is made up of 6 Grades, 20 Teacher, 275 Student and not every teacher teaches every Grade


I need a table that has Teacher Name, No. of Grades, No. of Student but I end up getting 6 Grades and 275 students for every teacher.

My expression is...  Aggr(Count(distinct [Grade]), [Teacher])

What am I doing wrong?

Neil

1 Solution

Accepted Solutions
sunny_talwar

Do you have Teacher and Grade in separate tables? Is the data model well connected if the data is coming from different tables? Also, if you Teacher Name as a dimension, then your expression should be enough (assuming that the data model is well linked)

Count(DISTINCT Grade)

View solution in original post

3 Replies
passionate
Specialist
Specialist

Please post your sample data and approach.

Because this is unusual.

sunny_talwar

Do you have Teacher and Grade in separate tables? Is the data model well connected if the data is coming from different tables? Also, if you Teacher Name as a dimension, then your expression should be enough (assuming that the data model is well linked)

Count(DISTINCT Grade)

Anonymous
Not applicable
Author

thank you Sunny.

I converted my single table into a multi-table star-schema and now I'm getting the right results.

Neil