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: 
shahamel
Creator
Creator

Urgent: firstsortedvalue

Dear QV-uers

4 febr. i have a deadline. this is my problem

How do you use

firstsortedvalue?

i want to count my students, sorted on highstest kwalification, funded, size education and connectionnumber

I think it is possible by using firstsortedvalue, but i don't know how, because i do not understand firstsortedvalue.

Help please

Gr. Sandeep

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See here for a tutorial on firstsortedvalue. I don't understand what you actually want to do. Can you post some sample data and what the results you want look like.


talk is cheap, supply exceeds demand
sebastiandperei
Specialist
Specialist

Hi Saha!

Sorry, but I can't understand your question. You need this in script or in a graph? Could you send the qvw?

shahamel
Creator
Creator
Author

Stel je voor:

student     diploma     datum

1               Niveau4     29-12-2012

1               Niveau3     14-04-2012

1               Niveau2     01-01-2012

2               NULL         10-10-2012

3               NULL         29-12-2012

3               Niveau3     29-12-2012

3               Niveau2     12-12-2012

Ik wil per jaar het aantal studenten dat gediplomeerd is delen op alle leerlingen, waarbij alleen

de hoogste diploma met worden geteld. Iedere student en diploma telt maar 1 keer mee.

shahamel
Creator
Creator
Author

student diploma date

1 Level4 29/12/2012

1 Level3 04/14/2012

1 Level2 01/01/2012

NULL 2 10.10.2012

3 NULL 12/29/2012

3 Level3 29/12/2012

3 Level2 12/12/2012

count(distinct student, where only want to count the highstest diploma achieved within that year) / count(TOTAL

student)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

With your sample data you can calculate it like this:

count({<diploma-={'NULL'}>} distinct student)/count(distinct student)

If NULL is not a literal text value but a null value use this instead:

count({<diploma={'*'}>} distinct student)/count(distinct student)

If you have to get such percentages over other dimensions use the aggr function. For example aggrageted over a dimension called funded:

aggr(count({<diploma={'*'}>} distinct student)/count(distinct student), funded)

You'll get a percentage for each value of funded.


talk is cheap, supply exceeds demand
shahamel
Creator
Creator
Author

It is not quite what i mean,

I want to make this calculation:

(PEOPLE_GRADUATED * 100) / TOTAL_PEOPLE

TOTAL_PEOPLE = COUNT ALL PEOPLE

PEOPLE GRADUATED =

TYPE_ONDERWIJS = BO     AND

STARTOCTOBER <= DATE_EXIT     AND

DATE_EXIT < TODATE AND

(SUCCES = 1 AND X = 1) OR (LEAVVE = 1 AND Y=1)

X = COUNT PEOPLE

     WHERE SUCCES = 1

     STARTOCTOBER = SCHOOLSTART AND

     DATE_EXIT < TODATE

 

// i want to use firstsortedvalue for sort by.

   SORT BY

          KWALIFICATION DESC

          FUNDED

          SIZE EDUCATION

          ISNULL(DATE_EXIT, DATE_ENDPLANNED) DEC

          CONNECTION NUMBER

Y = COUNT PEOPLE

     WHERE EXIT = 1

     STARTOCTOBER = SCHOOLSTART AND

     DATE_EXIT < TODATE

 

// i want to use firstsortedvalue for sort by.

   SORT BY

          IF(SUCCES NOTNULL, KWALIFICATION, ElSE 'NIVEAU0)'

          FUNDED

          SIZE EDUCATION

          ISNULL(DATE_EXIT, DATE_ENDPLANNED) DEC

          KWALIFICATION DESC

          CONNECTION NUMBER

Good luck