i assume you have 1 category per row in your data set and you can have any total number of rows per file (group).

you need to create 2 different formulas to see if each group has at least 1 row per group of NST and SET types.

//NST_flag

if {Category.Flag}= "NST" then 1 else 0

//SET_flag

if {Category.Flag}= "SET" then 1 else 0

create summaries for each of these a the group level

//NST Sum

sum(@NST_Flag,table.filenumber)

//SET sum

sum(@SET_Flag,table.filenumber)

now if each of these sums is > 0 then you have found a file (or group) that meets your conditions.