Returns date for a specified year, month, and day.
Syntax
Code Block |
---|
DateSerial(year, month, day) |
Arguments
year | Integer expression for year. |
---|
month | Integer expression for month. |
---|
day | Integer expression for day of month. |
---|
Examples
Code Block |
---|
DateSerial(2012, 12, 31) |
Following is an example of a calculated member in Time dimension Weekly hierarchy to get all full weeks from the last three months:
Code Block |
---|
Aggregate(Filter(
[Time.Weekly].[Week].Members,
DateBetween([Time.Weekly].CurrentMember.StartDate,
DateSerial(Year(Now()),Month(Now()) - 3,1),
DateSerial(Year(Now()),Month(Now()),-6)
)
)) |
DateSerial(Year(Now()), Month(Now()) - 3,1)
returns the first date of the month 3 months ago,
DateSerial(Year(Now()),Month(Now()),-6)
returns 7 days before the end of the current month to exclude a week which starts at the end of the last month and ends in the current month; if all weeks which start in the last month despite their end dates should be included, then write 0 instead of -6 - it returns the last day of a previous month.