# How to calculate YOY % through certain date?

Hi zwaters! Sorry for the delay. You are using table calculations (periodOverPeriod, etc), which as you correctly pointed out require the prior period data to be part of the query/visual (which is why you cant filter it out). This approach might not work for you table where you show each month, but if you just want a KPI that compares the last 12 months to the 12 months before that I would do it like we explain in this article: Period Over Period and Other Date Comparison Calculations (YoY, MoM, YTD, Rolling 7 days, etc)

So yours would look like:
Last 12 months: `ifelse(dateDiff({order_date},now(),"MM") <= 12, sales, 0)`
Last 13-24 months: `ifelse(dateDiff({order_date},now(),"MM") <= 24 AND dateDiff({order_date},now(),"MM") >12, sales, 0)`
YoY %: `sum(Last 12 Months) / sum(Last 13-24 months) - 1`

Then just put that last YoY % into your KPI visual (no filters needed).

Also now() is measuring it relative to the current date. You can change that to a parameter, or you could make another calc that finds the latest date in your data set and use that in here instead (would look like maxOver({your date field}, [ ], PRE_FILTER)