Forum Discussion
Comparison vs same week last year
- 6 years ago
All, I finally managed to find a solution here in this link https://forum.enterprisedna.co/t/same-period-last-year-for-fiscal-week-nbr-weeks-in-sales-table-are-non-standard/240/8
What I had to do was to create a measure based on the measure that you all had suggested.
One way to solve this is to add a period index in your date table for your week numbers, and the use this in the filter statement in your measure along the lines of.
Same week last year = CALCULATE([your measure],
FILTER(Date Table,
Date Table [period index] = SELECTEDVALUE(Date Table[period index]) -52))
For multiple selections use the MIN and MAX to establish the range.
EDIT: you might have to inlude a variable to cater for years with 53 week periods!
Here is an example:
YearWeek Table (I've actually created a new table) as in:
to set up the model like this:
And the build you measures and visuals referencing this YearWeek table, such as:
Sum of Forecast LY =
VAR Weeksinyear = CALCULATE(MAX('YearWeek Table'[Week of Year]);
ALLEXCEPT('YearWeek Table'; 'YearWeek Table'[Year]))
Return
CALCULATE([Sum Forecast];
FILTER(ALL('YearWeek Table');
'YearWeek Table'[YearWeek Index] = SELECTEDVALUE('YearWeek Table'[YearWeek Index]) - Weeksinyear))
To get you this:
All, I finally managed to find a solution here in this link https://forum.enterprisedna.co/t/same-period-last-year-for-fiscal-week-nbr-weeks-in-sales-table-are-non-standard/240/8
What I had to do was to create a measure based on the measure that you all had suggested.