DateSerial
Returns date for a specified year, month, and day.
Syntax
DateSerial(year, month, day)
Arguments
year | Integer expression for year. |
---|---|
month | Integer expression for month. |
day | Integer expression for day of month. |
Examples
DateSerial(2020, 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, 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 does 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.