We have a single table that captures daily sales and loans and we wanted to filter all loans.. so generally our loans will be quite high compared to actual sales ex:- sale value is ~38877and loan is ~1073173 and we wanted to filter all loans
sample data
date dept_id Sal
201907 10 723
201907 10 1073173
201907 10 38877
201907 10 100000
201907 10 500000
201908 20 16818
201908 20 701
201908 20 700
201908 20 850000
201908 20 1000000
201909 10 5909999
201909 10 19999997
201909 10 21999998
Expected Output as below
Y date dept_id Sal out_of_normal_values
201907 10 723 N<br> 201907 10 1073173 Y<br> 201907 10 38877 N<br> 201907 10 100000 Y
201907 10 500000 Y
201908 20 16818 N <br> 201908 20 701 N<br> 201908 20 700 N
201908 20 850000 Y
201908 20 1000000 Y
201909 10 5909999 Y<br> 201909 10 19999997 Y<br> 201909 10 21999998