Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problems with group by

Dear comminity, Im having trouble with a situation that I hope you can help me with.

Im trying to do the following:
I have a lot of data of students where. The data is:

ID - FirstYear (the year when he entered the University) - AcadYear (academic year) - AcadSem (Academical semester) - Program ID - Courses - CourseLvl.

The first problem is: I have some students that entered in a year, then quit and later they re enter. What I want to do is show only the latest register of their entrance to the University.

The second problem is: Each and every student has a different number of courses they take each semester (semester 1 or 2). Each course has a level. The level that the student currently is, is the lowest of the level of the courses that he is currently taking.

Here is the sample data:

 

IDFirstYearAcadYearAcadSemProgramIDCoursesCourseLvl
1199619961aa1
1201420141ba1
1201420141bb1
1201420141bc1
1201420141bd1
1201420141be1
1201420142ba1
1201420142bf2
1201420142bg2
1201420142bh2
1201420151ba1
1201420151bi3
1201420151bj3
1201420151bk3
1201420152bl3
1201420152ba1

As you can see, the student 1 has two years when he entered the university (1996 and 2014) I want to get only the data from the latest entrance.

Then with the 2014 entrance, I have a lot of courses that he is taking. If I want to know which level he is, I have to see which is the lowest level of the courses he is taking on the latest registry (AcadYear=2015 and AcadSem=2). So in this case the level of the student would be 1, because even if he has courses from level 3, he is still doing the course "a" which is on lvl 1.

I know that the way to do this is with a group by on the back end (that's the way I tried) but I can't do it yet.
Hope you can help me with this.

Thanks a lot.

1 Reply
alexpanjhc
Specialist
Specialist

I think firstsortedvalue() can be used here.

see attached.