DateCompare
EAZYBI Returns 1 if the first date is greater than the second date; returns 0 if both dates are equal; returns -1 if the first date is less than the second date.
Syntax
DateCompare(Date_Expression, Date_Expression)
Arguments
Date_Expression | MDX expression that returns a date that will be compared. |
---|
You can also use a string expression that can be parsed with DateParse as any date argument.
Examples
Compare the Due date to the current day
The formula will return -1 if due date of the issue is before Today, 0 if an issue is due Today, and 1 if an issue due date is after Today. See example report Issues due and overdue in our demo account. The calculated measure Issues due in time uses the formula above to check if issue is not due yet and a similar comparison with resolution date for resolved issues before due date.
DateCompare([Issue].CurrentMember.Get('Due date'), "Today")
Compare the Resolution date to a custom date
This formula compares a custom date to the resolution date of the issue currently in context.
DateCompare( [Issue].CurrentHierarchyMember.Get('Resolved at'), '2025-05-15' )
This formula compares a relative date to the resolution date of the issues currently in context.
DateCompare( [Issue].CurrentHierarchyMember.Get('Resolved at'), '1 month ago' )
See also
- Function DateParse(), which converts dates in string format to date format;
- Relative dates and date filters.