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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
karthikeyan1504
Creator III
Creator III

Query on auto increment concept

Hi all,

hic‌, gwassenaar‌, sunindia‌, tresesco‌, settu_periasamy

I have a data as shown below,

Academic_Year, Student_No

2012/2013, 001

2013/2014, 001

2014/2015, 001

2015/2016, 001

2010/2011, 002

2011/2012, 002

2012/2013, 002

2013/2014, 002

2009/2010, 003

2010/2011, 003

2011/2012, 004

2012/2013, 004

Now I have a requirement to create the Year of Study field for the students.

For example,

Academic_Year, Student_No, Year of Study

2012/2013, 001, 1

2013/2014, 001, 2

2014/2015, 001, 3

2015/2016, 001, 4

2010/2011, 002, 1

2011/2012, 002, 2

2012/2013, 002, 3

2013/2014, 002, 4

2009/2010, 003, 1

2010/2011, 003, 2

2011/2012, 004, 1

2012/2013, 004, 2

Could anyone please advise me how to derive the field Year of Study?

Thanks & Regards,

Karthikeyan.

13 Replies
Mark_Little
Luminary
Luminary

Hi,

swuehl approach is certainly the easiest approach and the way I would tackle this.

Mark

karthikeyan1504
Creator III
Creator III
Author

Hi Swehl,

your solution also is correct. As I have got few discrepancies with my real data, the solution is not working properly.

Few student numbers are repeated for the same year.

Thanks for your help!!!

swuehl
MVP
MVP

You can also use

LOAD *,

          AutoNumber(Academic_Year, Student_No) as Year_of_Study

to handle multiple lines for a student in the same year. Still, the Academic_Year needs to be chronological / sorted per student.