DateDiffDays

Returns number of days from first date to second date.

Syntax

 DateDiffDays(from_date, to_date)

Arguments

from_date
MDX expression that returns a date.
to_date
MDX expression that returns a date.

Examples

Following example calculates how many days has the issue been in current status.

DateDiffDays([Measures].[Issue status updated date], Now())

Example bellow will return how many issues, that have been open 14 to 30 days ago from now, are still due.

NonZero(
  Count(
    Filter(
	  Descendants([Issue].CurrentMember, [Issue].[Issue]),
	  [Measures].[Issues due] > 0 AND
      DateDiffDays([Issue].CurrentMember.get('Created at'),
        Now()) >= 14 AND
      DateDiffDays([Issue].CurrentMember.get('Created at'),
        Now()) < 30
)))

See also

  • The above is an example how to use the DateDiffDays function. Note that more efficient way of calculating issues due in various age intervals would be to use the Age intervals dimension.
  • Function DateDiffWorkdays which returns number of working days between two dates.