Assuming that the Day member names are as in the sample data, so that
the Day of Week can be derived from them:
Quote:
|
iif([Period].[TCCC 445].CurrentMember
|
is [Period].[TCCC 445].[All Periods],
(ParallelPeriod([Period].[Gregorian].[Year]),
[Measures].[Unit Cases]),
iif([Period].[TCCC 445].CurrentMember.Level
is [Period].[TCCC 445].[Day] and
[Period].[TCCC 445].Parent
is OpeningPeriod([Period].[TCCC 445].[Week],
Ancestor([Period].[TCCC 445].CurrentMember,
[Period].[TCCC 445].[Year])),
(Generate({[Period].[TCCC 445].CurrentMember} as CurDay,
Filter(ParallelPeriod([Period].[TCCC 445].[Year], 1,
[Period].[TCCC 445].Parent).Children,
Right(CStr([Period].[TCCC 445].CurrentMember.Name), 5)
= Right(CStr(CurDay.Item(0).Name), 5))).Item(0),
[Measures].[Unit Cases]),
(ParallelPeriod([Period].[TCCC 445].[Year]),
[Measures].[Unit Cases])))
But could there be an issue when the first week of a year is less than 7
days (which was listed as a possibility)? How can you then be sure to
find the same day of week?
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.developersdex.com ***