I need an elegant way to select the same day in each week, for the last 13 or more weeks.
I tryied the folowing solution:
SELECT
{
[Date].[Year-Month-Day].[Day].&[2007]&[10]&[2],
ParallelPeriod([Date].[Year-Month-Day].[Day],7, [Order Date].[Year-Month-Day].[Day].&[2007]&[10]&[2]),
ParallelPeriod([Date].[Year-Month-Day].[Day],14, [Order Date].[Year-Month-Day].[Day].&[2007]&[10]&[2])
} ON ROWS,
{} ON COLUMNS
FROM [Adventure Works Cube]
Which returns two Tuesdays.
But for 13 months I need to add many lines of code.
I consider the date 2007-10-02 as a sample date that i will replace with a parameter later in my code.
Thanks!
You can use something like this: