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.
It comes under Time & Intelligence Dax function Category.
Dates – A column with dates.
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 Sept 13, 2020, this function returns all dates for the month of Aug, 2020.
So, Let’s start with an example, download the sample Dataset from below link
Step-1: Create a calendar table to using existing dataset “Order Date” column.
Go to Modeling Tab > Click to table icon & write below DAX
Calendar = CALENDAR(MIN(Orders[Order Date]), MAX(Orders[Order Date]))
Step-2: Now, create a measure to get Previous Month Sale.
PREVIOUSMONTH = CALCULATE(SUM(Orders[Sales]), PREVIOUSMONTH('Calendar'[Date]))
Step-3: Drag Date Column from Calendar table & Sales from Order Table.
What happen if you will use date instead of Month?
As you see in above screen shot, it will return total sum of previous month sales against current month each dates, here previous month was January and current month is February.
Recommended Post : PREVIOUSDAY DAX Function
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.