Tutorial with example
In today’s video I we will go through how to build a time intelligence measure in DAX using the PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER, PREVIOUSYEAR.
We will first go through PREVIOUSYEAR DAX function and explain how can those functions can be combined with CALCULATE to create the correct measure.
We move on to PREVIOUSQUARTER DAX functionwhere we go through how to that measure works and create an example.
Next will be PREVIOUSMONTH DAX function where we go through what the “first day in the current context” means.
And finally we go through PREVIOUSDAY DAX example where we go through what happens when we dont have continuous days in our sales table.
Download example file:
This function returns all dates from the previous year given the latest date in the input parameter. For example, if the latest date in the dates argument refers to the year 2009, then this function returns all dates for the year of 2008, up to the specified year_end_date.
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.
This DAX function is not supported for use in DirectQuery mode.