PREVIOUSMONTH Function (DAX)

How does the PREVIOUSMONTH function (DAX) work?

The PREVIOUSMONTH function (DAX) returns a table that contains a column of all dates from the previous month, based on the first date in the dates column, in the current context.

PREVIOUSMONTH Formula Syntax

PREVIOUSMONTH (
     <dates>
)

How do you use the PREVIOUSMONTH function?

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.

Related Blog Posts

Related Support Forum Posts

Time comparisons – PREVIOUSMONTH, PARALLELPERIOD
Get a Difference from Previous Month with several Categories
Financial templates vsLastYear make sameperiod

Considerations when using the PREVIOUSMONTH function

Constraints on Boolean expressions −

  • The expression cannot reference a calculated field.
  • The expression cannot use CALCULATE function.
  • The expression cannot use any function that scans a table or returns a table, including aggregation functions.

However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.

Related Video Tutorials

Formula examples using the PREVIOUSMONTH function

=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSMONTH(‘DateTime'[DateKey]))

Related DAX Functions

PREVIOUSQUARTER
PREVIOUSYEAR

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership