case X of {Cat, N} when Cat == expense; Cat == invoice; Cat == loss -> Total - N; {credit, N} -> Total + N end
> you can sometimes ameliorate it with guards
which is exactly what you did, so I don't think you're disagreeing here :)