Robin leaves for Derek and the mood goes down. Ted cheers up,
Okay, nobody get down. We knew this going in.
(How I met your mother S1 Ep11)
I think it means "we knew that this was going happen."
Why does he say go "in"?
No, it means they knew this was going to happen when they made their decision. "Going in" to the situation. Say you are studying engineering. You could say "there is a lot of homework, but I knew that going in" meaning that you knew there would be a lot of homework before you decided to study engineering. It wasn't something you found out about after, you knew it before.