Skip to main content
Skip table of contents

DateSerial

Returns date for a specified year, month, and day.

Syntax

CODE
DateSerial(year, month, day)

Arguments

yearInteger expression for year.
monthInteger expression for month.
dayInteger expression for day of month.

Examples

CODE
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
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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.