Forum Discussion

ESemba22's avatar
ESemba22
Frequent Visitor
3 years ago

How Do I keep Sales PY Calculation When a Filter is Applied?

Hi! I am an extreme novice and have scratched together some Dashboards in PBI with little to no knowledge of whether or not the way I am going abnout things is best practice.

 

My issue is I have time series data formatted below that goes back 104 weeks by item

I have a date table to roll up all of the various data sources I have so they have a consistent week ending date. (Although not neccesary for this dashboard as it only has one data source/retailer)

And then I created a Date Filter table so I could use slicers to select 52/26/12 weeks time periods

Using these calculations

Since there is no column for Sales PY in my data I just want to make a command that finds the sales for the same item/brand etc for the same exact period/week last year and this is what I came up with after failing with SAMEPERIODLASTYEAR

It appears to work when I don't have the date filter/slicer applied as shown below

However there are a few issues...
1.  Since my date table runs into the future it forward calculates the PY sales.  I only want my data to go up to the most recent current year date
2. When I apply my date filter slicer to 52 weeks the PY sales dissappear as shown below. I fundamentaly can understand why they would as the filter is only showing data from the last 52 weeks and therefore I would assume it omits going back further to pull those PY dates.  I just don't know how to go about fixing this

Let me know if any other context is necessary. Thank you!

9 Replies