you need to combine act and pl rows into a single row
try with script like this.
tempmaintable:
load Reference,AccountNo,ACT
from yoursource
where Type='ACT'
;
outer join (tempmaintable)
load Reference,AccountNo,PL
from yoursource
where Type='PL'
;
maintable:
load *
, If(ACT<PL,'Yes','No) as PlGreaterFlag
resident
tempmaintable;
drop table tempmaintable;