Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all
I am a new user of qlik products
I have a question
I have two tables ( 'StudentTable' and 'GradeTable')
I set up a third table called 'CalculationGradeTable'
Calculates the student's score(SetMark)
Example :
If the student takes the grade of 40, he supposed to have a 'Poor' rating Dependence on 'MinGrade, MaxGrade' field
If the student takes the grade of 88 he should have a 'very good' rating Dependence on 'MinGrade, MaxGrade' field
The valuation should be calculated with the 'SetMark' column
How to do it !!
// My Code ....
StudentTable:
LOAD * INLINE [
IDStd,NameStd,GradeStd
1,'A',40
2,'B',85
3,'C',75
4,'D',45
5,'E',3
6,'F',100
];
GradeTable:
LOAD * INLINE [
MinGrade, MaxGrade,Mark
0, 59 , 'Poor'
60, 75,'good'
76, 89,'very good'
90, 100,'Excellent'
];
CalculationGradeTable:
LOAD
IDStd as ID ,
NameStd as Name ,
IF( GradeStd >= Peek('MinGrade',0,'GradeTable') and
GradeStd <=Peek('MaxGrade',0,'GradeTable')
, Peek('Mark',0 ,'GradeTable'),
IF( GradeStd >= Peek('MinGrade',1,'GradeTable') and
GradeStd <=Peek('MaxGrade',1,'GradeTable')
, Peek('Mark',1 ,'GradeTable'),
IF( GradeStd >= Peek('MinGrade',2,'GradeTable') and
GradeStd <=Peek('MaxGrade',2,'GradeTable')
, Peek('Mark',2 ,'GradeTable'),
IF( GradeStd >= Peek('MinGrade',3,'GradeTable') and
GradeStd <=Peek('MaxGrade',3,'GradeTable')
, Peek('Mark',3 ,'GradeTable')
)))) as SetMark
Resident StudentTable
Order By GradeStd desc ;
Maybe try like this:
StudentTable: LOAD * INLINE [ IDStd,NameStd,GradeStd 1,'A',40 2,'B',85 3,'C',75 4,'D',45 5,'E',3 6,'F',100 ]; GradeTable: LOAD * INLINE [ MinGrade, MaxGrade,Mark 0, 59 , 'Poor' 60, 75,'good' 76, 89,'very good' 90, 100,'Excellent' ]; left Join IntervalMatch(GradeStd) Final: LOAD MinGrade,MaxGrade Resident GradeTable;
Maybe try like this:
StudentTable: LOAD * INLINE [ IDStd,NameStd,GradeStd 1,'A',40 2,'B',85 3,'C',75 4,'D',45 5,'E',3 6,'F',100 ]; GradeTable: LOAD * INLINE [ MinGrade, MaxGrade,Mark 0, 59 , 'Poor' 60, 75,'good' 76, 89,'very good' 90, 100,'Excellent' ]; left Join IntervalMatch(GradeStd) Final: LOAD MinGrade,MaxGrade Resident GradeTable;
I suggest that you use the intervalmatch solution already posted. That would normally be the correct way to solve your problem. Do you have a specific reason not to use interval matching?