DAX Calendar Specific Measure

Modified on Sat, 29 Jun at 2:43 AM

Overview

These are specific time period calculations that are appropriate in the following areas:

  • Traditional Financial Statements. e.g. Current Period-to-date, Last Month, Previous Year-to-Date
  • Sales, Inventory (or Any Detail Data Model).  e.g. Current Quarter-to-Date, Sales last 60 days
  • Single Tile Metrics. e.g. Sales Yesterday
  • Comparisons.  e.g. Current Month-to-Date next to Previous Year Month-to-Date


The big difference between the ? Calendar Pattern Measures and the Calendar Specific Measures is that the ? Calendar Pattern Measures cover complete time periods, e.g. Year, Month whereas the Calendar Specific Measures generally cover aggregation of data up to a "today" or "to-date" period, e.g. Year-to-Date, or Month-to-Date - OR - aggregation of a specific whole time period e.g. Current Month, Last Month, Previous Year Month.


NOTE: Today's date is configured in the QQube Configuration Tool

 

Subcategories - Common

Here is a list of measures which are used in almost all data models.  The majority are based upon transaction date.  However Vehicle Mileage is based upon Trip End Date, and Payroll is based upon Effective Payroll Date.


Antecedent Measures
Last MonthFull month previous to current month; current month is based upon Today's date.
Last Month-to-DateMonth-to-date previous to current month; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Last QuarterFull quarter previous to current quarter; current quarter is based upon Today's date.
Last Quarter-to-DateQuarter-to-date previous to current quarter; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Last WeekFull week previous to current week; current week contains Today's date.
Last Week-to-DateWeek-to-date previous to current week; to-date represents same week day as Today's date.
Current Measures
Current MonthFull month with current month containing Today's date.
Current Month-to-DateMonth to Today's date.
Current QuarterFull quarter actual amount with current quarter containing Today's Date.
Current Quarter-to-DateQuarter to Today's date.
Current WeekFull week with current week containing Today's date.
Current Week-to-DateWeek to Today's date; Sunday is day one.
Current YearFull year with current year containing Today's date.
Current Year-to-DateYear to Today's date.
Current Year-to-Last MonthYear to end of month previous to current month; current month is based upon Today's date.
Previous Year Measures
Previous YearFull year previous to current year; current year contains Today's date.
Previous Year Last MonthFull month, 13 months previous to current month; current month is based upon Today's date.
Previous Year Last QuarterFull quarter, 5 quarters previous to current quarter; current month is based upon Today's date.
Previous Year MonthFull month, 12 months previous to current month; current month is based upon Today's date.
Previous Year Month-to-DateMonth-to-date 12 months previous to current month-to-date; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Previous Year QuarterFull quarter, 4 quarters previous to current quarter; current quarter contains Today's date.
Previous Year Quarter-to-DateQuarter-to-date 12 months previous to current quarter-to-date; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Previous Year-to-DateYear-to-date 12 months previous to current year-to-date; to-date represents same week day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Previous Year-to-Last MonthFull month 13 months previous to current month; current month is based upon Today's date.
Today Measures
TodayToday's date.
Tomorrow Measures
TomorrowToday's date plus 1 day.
Yesterday
YesterdayToday's date minus 1 day.

 

Subcategories - Extended Future Dates

These would be used (along with others) for:

  • Expected Date (Open Purchase Orders)
  • Ship Date (Open Sales Orders)
  • Pending Builds


Extended Future Date Measures
Next MonthFull month previous to current month; current month is based upon Today's date.
Next QuarterMonth-to-date previous to current month; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Next WeekFull quarter previous to current quarter; current quarter is based upon Today's date.
Next Two WeeksQuarter-to-date previous to current quarter; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Next Year

 

Subcategories - Inventory

These are used specifically in the Inventory Data Model


Sales Order (Original and Initial Invoiced) Measures
Last 30 DaysFull month previous to current month; current month is based upon Today's date.
Last 365 DaysMonth-to-date previous to current month; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.
Sales
Last 30 DaysFull quarter previous to current quarter; current quarter is based upon Today's date.
Last 60 DaysQuarter-to-date previous to current quarter; to-date represents same day as Today's date; If the requested date is past the last day of the corresponding month, then the last day of the month is returned.

 

Examples

 

Current Month Actual =
IF (
    [[DAXP]] ShowValueForDates],
    VAR todayselection = [[DAXP]] Today Selection]
    VAR LastMonthAvailable =
        CALCULATE (
            MAX ( 'Calendar'[Year Month Number] ),
            'Calendar'[Date] = todayselection
        )
    VAR Result =
        CALCULATE (
            [.Hierarchy Actual],
            ALLEXCEPT (
                'Calendar',
                'Calendar'[Day Holiday Name],
                'Calendar'[Day is Working Day],
                'Calendar'[Day of Week Abbr]
            ),
            'Calendar'[Year Month Number] = LastMonthAvailable,
            ALL ( 'Calendar' )
        )
    RETURN
        Result
)

 

Current Month-to-Date Actual =
IF (
    [[DAXP]] ShowValueForDates],
    VAR todayselection = [[DAXP]] Today Selection]
    VAR LastMonthAvailable =
        CALCULATE (
            MAX ( 'Calendar'[Year Month Number] ),
            'Calendar'[Date] = todayselection
        )
    VAR Result =
        CALCULATE (
            [.Hierarchy Actual],
            ALLEXCEPT (
                'Calendar',
                'Calendar'[Day Holiday Name],
                'Calendar'[Day is Working Day],
                'Calendar'[Day of Week Abbr]
            ),
            'Calendar'[Year Month Number] = LastMonthAvailable,
            'Calendar'[SequentialDayNumber] <= todayselection,
            ALL ( 'Calendar' )
        )
    RETURN
        Result
)

 

We use three filter-safe columns which are always preserved regardless of all other filters applied to a measure:

  • 'Calendar'[Day Holiday Name]
  • 'Calendar'[Day is Working Day]
  • 'Calendar'[Day of Week Abbr]


We added 'Day is Working Day' in Version 10

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article