image-2

How to Use DATEADD to Generate Comparisons Over a Range of Different Time Frames

DATEADD is a flexible and powerful DAX function. DATEADD takes in a date column, the offset, and the time interval for the offest. The offset is the number of intervals to go forward or back in time. Example Formulas: Rev Previous_Day = CALCULATE(SUM(TransactionData[Revenue]),DATEADD(CalenderDate[Date],-1,DAY) Rev Previous_Month = CALCULATE(SUM(TransactionData[Revenue]),DATEADD(CalenderDate[Date],-1,MONTH)) Rev Previous_Quarter = CALCULATE(SUM(TransactionData[Revenue]),DATEADD(CalenderDate[Date],-1,QUARTER) Rev Previous_Year = CALCULATE(SUM(TransactionData[Revenue]),DATEADD(CalenderDate[Date],-1,YEAR))