Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

neil_gabin
New Contributor III

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

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Count the number of students each teacher has in a table

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)

3 Replies
passionate
Valued Contributor

Re: Count the number of students each teacher has in a table

Please post your sample data and approach.

Because this is unusual.

MVP
MVP

Re: Count the number of students each teacher has in a table

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)

neil_gabin
New Contributor III

Re: Count the number of students each teacher has in a table

thank you Sunny.

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

Neil