Forum Discussion

samwong's avatar
samwong
Advocate I
9 years ago
Solved

Time Intelligence functions and dot notation

Hello, newbie here but I could not find any relevant information in the forums (perhaps my search terms are wrong).   I am confused with using dot notation in the time intelligence functions.  Perh...
  • mattbrice's avatar
    mattbrice
    9 years ago

    Time intelligence functions work by shifting around the "window" of dates that are visible in the filter context, not by performing math on the Data[Date] column to "create" values that don't already exist in the column.  So the dates must exist for the functions to work properly.  In your example the PREVIOUSYEAR() function call will return all the dates from the previous year, given the last date visible in Data[Date] column - but only if they exist.  PREVIOIUSYEAR () as called will basically do this:

     

    FILTER ( ALL ( Data[Date] ), YEAR ( Data[Date] ) = YEAR ( MAX ( Data[Date] ) ) - 1 ) 

    So one reason to use a separate Calendar table is to be sure you have all contiguous dates needed.  Once you have studied up on Dax you'll realize having a separate Calendar table with full year, contiguous dates is a best practice.