DateSerial
Returns date for a specified year, month, and day.
Syntax
DateSerial(Year_Numeric_Expression, Month_Numeric_Expression, Day_Numeric_Expression)
Arguments
Year_Numeric_Expression | Integer expression for a year. |
---|---|
Month_Numeric_Expression | Integer expression for a month. |
Day_Numeric_Expression | Integer expression for a day of the month. |
Examples
DateSerial(2023, 12, 31)
The following example shows a calculated member in Time dimension Weekly hierarchy to get all full weeks from the last three months, including the current month:
Aggregate( [Time.Weekly].[Week].DateMembersBetween( DateSerial(Year(Now()), Month(Now())-2, -6), DateSerial(Year(Now()), Month(Now())+1, 0) ) )
DateSerial(Year(Now()), Month(Now())-2, -6)
returns 7 days before the end of the 2 months ago to include a week where months do not start with the first day of the week.DateSerial(Year(Now()), Month(Now())+1, 0)
returns the last day of the current month.
See report example Most active days by weeks and weekdays in our Demo account. The calculated member Last three months in dimension Time uses the formula above. The report uses this calculated member and several others calculated members in Time dimensions as a selection option on Pages.