DAX Function Guide
DATEADD
Sam McKay
CEO & Founder
How does the DATEADD work?
DATEADD Formula Syntax
DATEADD(
<dates>,<number_of_intervals>,<interval>
)
How do you use the DATEADD?
DATEADD function used to generate time comparisons over a range of different time frames. Allows you to compare a measure to any time period, you can look at other time periods such as day, month, or quarter.
It can be used also when calculating the Percentage change,Difference between time periods and Cumulative sales.
Related Blog Posts
Loading
Considerations when using the DATEADD?
The dates argument can be any of the following:
- A reference to a date/time column,
- A table expression that returns a single column of date/time values,
- A Boolean expression that defines a single-column table of date/time values.
If the number specified for number_of_intervals is positive, the dates in dates are moved forward in time; if the number is negative, the dates in dates are shifted back in time.
The interval parameter is an enumeration, not a set of strings; therefore values should not be enclosed in quotation marks. Also, the values: year
, quarter
, month
, day
should be spelled in full when using them.
The result table includes only dates that exist in the dates column.
If the dates in the current context do not form a contiguous interval, the function returns an error.
Related Video Tutorials
Loading
Formula examples using the DATEADD
=DATEADD(DateTime[DateKey],-1,year)
= DATEADD(Sales[Today’s Date],-1,DAY), 1, 0)
= CALCULATE( [Total Sales], DATEADD( Dates[Date], -1 ) )
Related Courses
Loading