Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Qlikers!
I need to fill the data as below :
Input :
Rec No | Value | Outlier Flag |
1 | 32 | 0 |
2 | 628.167 | 1 |
3 | 31.2667 | 0 |
Output:
1 | 32 |
2 | 31.6335 |
3 | 31.2667 |
628.167 is an outlier in my data, I need to fill it with the average of the previous and the next row (using the script):
in this case (32+31.2667)/2 = 31.6335
Thank you in advance
Mario
@Mario3 only for this line ? (one line )
No the whole data set.
the outliers is flagged as "1"
In case the previous and the next row of the outliers are not an outlier I need to apply this formula that I mentioned.
Appreciate your help!
Hello @Taoufiq_Zarra any idea how to solve this ?
Maybe like this:
tmp:
load * Inline [
RecNo,Value_,OutlierFlag
1,32,0
2,628.167,1
3,31.2667,0 ];
final:
LOAD
RecNo,
if(OutlierFlag=1,(PREVIOUS(Value_)+PEEK('Value_',RowNo(),'tmp'))/2,Value_) as Val,
OutlierFlag
RESIDENT tmp;
DROP TABLE tmp;