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 function where 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 don’t have continuous days in our sales table.
Table of contents:
Watch the tutorial:
Links to the mentioned resources
To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #74
This function returns all dates from the previous month, using the first date in the column used as input. For example, if the first date in the dates argument refers to June 10, 2009, this function returns all dates for the month of May, 2009.
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.
Need more examples to practice?
Comparing periods is something you should always do as it adds context to your data, but how do you calculate Same period last month?
PREVIOUSMONTH function will give you the entire previous month, so how do you do it?