Formula changes when I use filters

On the current spreadsheet I’m working on I have one formula copied multiple times. The gist of the formula is it uses cells from the exact same row (K, L) except for one (Q2). I did the formula once and copy and pasted it to each row. Now when I use filters to reorganize the data it it switches the Q cell to a random one instead of Q2.

For the sake of trying everything I remade the formula without copy and pasting it and I still had the same problem