Tagged: prior year
June 16, 2016 at 2:18 am #4961
I’m looking for a way to pull in prior year, prior week sales when using a 52 week calendar. I tried a formula:
=CALCULATE(‘Reporting Data'[Total Actual],’Reporting Data'[CY Week]=’Reporting Data'[PY Week])
Thinking that if I’m pulling second quarter data then week 14 for 2016 would pull week 14 for 2015 as well? Unfortunately it results in an error.
Any suggestions would be appreciated.June 16, 2016 at 10:06 pm #4972
What error was raised?
Looks like your model consists of a single table. To get the results you want, I believe you should at least have two tables, one for data and one for dates/weeks lookup.
What version of Excel are you using?
Why not use a 365 day year calendar with a column to indicate week number?
TomJune 18, 2016 at 2:30 am #4994
Thanks for the response. I’m using Excel 2010 and I’m using a 52 week calendar because that’s what my company uses for reporting. I tried a slightly different formula:
=CALCULATE(‘Reporting Data'[Total Actual],SAMEPERIODLASTYEAR(‘Reporting Data'[PY Week Ended]))
For [PY Week Ended] if the week ended is 6/18/2016 then it returns 6/20/2015 (factoring for the leap year). I don’t get an error now, but it doesn’t return the prior year’s same week sales value either.June 18, 2016 at 3:00 am #4995
The built-in time intelligence functions (like same SAMEPERIODLASTYEAR) are designed to work with the “classic” 365-days-per-year calendar.
Do your calendar weeks follow the 4-4-5 pattern for months?June 19, 2016 at 1:25 am #4999
Yes…I thought I could trick / facilitate by creating a prior year column. It is indeed a 4-4-5 schedule that we are on.June 19, 2016 at 3:13 pm #5005
I’m trying to do this in the pivot and I think it needs to be done within the data table. I’ve got data in rows with:
from there I added formulas for:
same day prior year (to link up to the week ended)
So in this new formula I’m trying to pull [actual] when [week ended] equals [same day prior year] but the unique identifier could by the country. As an example on the line for 6/18/2016 for Singapore where same day prior year equals 6/20/2015 then I want to pull that actual value from the line for 6/20/2015 for Singapore and return it on that line for 6/18/2016 for Singapore.
I’m assuming this is easiest way? I could reload my data with a column for the prior year values, but it’s better to use a formula vs. manually loading as we continue to build the data.June 20, 2016 at 4:10 pm #5006
Please see pages 245 – 261 of “Power Pivot and Power BI” by Rob Collie and Avi Singh which discusses custom calendars (much of the discussion focuses on the 4-4-5 calendar).
It still looks like you are using a single table data model like you would with a pivot table in regular Excel. Is this so?
TomJune 20, 2016 at 7:02 pm #5009
I got the book about a week ago but am only up to page 100 something in between some travel.
I’m like a kid at Christmas digging into to work already but I’ve been trying to do as the book advises and read it straight through.
Yes…I am using a single data table at this point.
I appreciate all your help. I’ll let you know how it works out.June 20, 2016 at 10:33 pm #5014
I am mightily convinced, that the way up and out with the minimum amount of learning curve is with a multi-table model.
If I can help you build a multi-table model (which I do not think will be that difficult), let me know.
TomJune 21, 2016 at 3:45 pm #5036
It worked…GFITW! Thanks for your assistance. I have converted to a multi-table model as well. This will be helpful as it should allow me to forecast updates for comparison. Good stuff!
The forum ‘Power Pivot’ is closed to new topics and replies.