Write complex formula in custom expression


Can we write this complex formula in metabase? if yes please guide me how to write ? I have tried so many things but unable to write.

B7 is the last week count, B1 is the first count (how we get these values in our custom expression)?

I think this is not a Metabase question, it's more like a SQL query question.