Here's a VBA version - may not be the most efficient:
Quote:
|
With Member [Measures].[IsLeapYear] as
|
'Day(DateSerial(CInt(Ancestor([Time].CurrentMember,
[Time].[Year]).Name), 2, 28) + 1) = 29'
Select {[Measures].[IsLeapYear]} on 0,
[Time].[Month].Members on 1
from Sales
This is based on the VBA Developer's Handbook Chapter 2: Working with
Dates and Times:
http://msdn.microsoft.com/library/de.../en-us/dnvbade
v/html/isthisleapyear.asp
Yes, you could write the code to handle this yourself, and it's not all
that difficult. But why do it? VBA is already handling the algorithm
internally. It knows that the day after February 28 (in all but a leap
year) is March 1 but in a leap year it's February 29. To take advantage
of this fact, dhIsLeapYear (shown in Listing 2.16) calculates the answer
for you.
...
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.developersdex.com ***