moY planned and realized expenses

Hi there, I have an issue, and can't figure out how to accomplish this. I have written a Custom SQL query for pulling data about planned expenses and realized expenses. These are the columns: Department, Date, planed expenses and Realized expenses.

I need to visualize, how much a department has already spent, based on a date filter on a dashboard, in contrast to the planned expenses for the same department for q whole year.

I need to show, how much the department has money left for spending.

I ve made YoY, MoM visualizations, but can't get this one right:

I would guess that this is more a data engineering issue rather than a Metabase issue. E.g. if a value should not be affected by a filter but others are, then that value should be fixed in a table (e.g. all rows should have the same fixed value). Am I understanding this correctly?