I don't remember all the rules, but it has to do with whether or not the Department/Class are visible on each line of the transaction versus the header and/or whether or not they’re filled in.
Generally I thought if you don't have Dept/Class exposed on the line item, all lines will take the value of the header Dept/Class value while if you do have them visible, each line will match whatever value is input on the transaction on the GL impact.
All that said, you mentioned revenue, so it could be that ARM (revenue module) has different rules. I don't remember. There's definitely a bunch of complexity around it.