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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Classification based on calculated range in load script

Hi all

I have the following script to group airports based on a calculated index into A, B, C and D. However, Qlikview keeps detecting and error. Can anyone help?

//CALCULATION OF DEPARTURE AIRPORT INDEX 

NoConcatenate 

DEP_AIRPORT_INDEX: 

LOAD *, 

(DEP_CARRIER/MAX_DEP_CARRIER)+(DEP_FLIGHTS/MAX_DEP_FLIGHTS)+(DEP_DIST_GROUP/MAX_DEP_DIST_GROUP)+(DEP_AIRPORT_COUNT/MAX_DEP_AIRPORT_COUNT) as DEP_AIRPORT_INDEX 

Resident DEP_AIRPORT;// THIS IS A TABLE OF THE AIRPORTS WITH ALL OF THEIR RESPECTIVE ATTRIBUTES

//ASSIGNING GRADES TO THE AIRPORTS

NoConcatenate

DEP_AIRPORT_GRADE:

LOAD*,

if (DEP_AIRPORT_INDEX<=fractile(DEP_AIRPORT_INDEX,0.25),'D',

if (fractile(DEP_AIRPORT_INDEX,0.25)<DEP_AIRPORT_INDEX<=fractile(DEP_AIRPORT_INDEX,0.5),'C',

if (fractile(DEP_AIRPORT_INDEX,0.5)<DEP_AIRPORT_INDEX<=fractile(DEP_AIRPORT_INDEX,0.75),'B',

if (fractile(DEP_AIRPORT_INDEX,0.75)<DEP_AIRPORT_INDEX,'A', 'NULL')))) as GRADE_DEP_AIRPORT

FROM DEP_AIRPORT;

Labels (1)
2 Replies
Clever_Anjos
Support
Support

You should post your question only once: Classification based on calculated value

swuehl
Champion III
Champion III

Fractile() is a statistical aggregation function. Aggregations in general need a GROUP BY clause when used in the script, and all fields not listed in the group by clause need to be aggregated.