You should set a flag for Type = FTE and using the Flag you can create a expression in UI.
Else you can use below the expression in UI
Are you using the expression in Load statement or assigning the value to a variable?
It won't work so easily in script with the reason of having aggregation involved, you may try as below -
1. First calculate sum(number) using where clause and group by clause in separate table
2. join the sum no to the old table so that sum field is available in all records
3. then compare the type field with the new sum field as you are trying to do.
May not completely correct, if you share your script, can add something further.
It's hard to say without more info. Making some assumptions you could do something like this:
LOAD * INLINE [
Team, Type, Number
A, Actual, 4
A, Actual, 3
A, FTE, 6
B, Actual, 1
B, Actual, 2
B, FTE, 4
if(Actual>FTE,'OVERSTAFFED','UNDERSTAFFED') as Status
Sum(ActualNbr) as Actual,
Sum(FTENbr) as FTE
group by Team
if(Type='Actual',Number,0) as ActualNbr,
if(Type='FTE',Number,0) as FTENbr
It would give you an output like this.