Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Help working with previousmonth function


Need help working with Time Intelligence Functions, I'm working with Sales data and trying to compare period over period sales, so to compare to previous month I tried creating a column using the following :

PriorPeriodSales$ = CALCULATE(sum('Sales'[SalesAmount]),PARALLELPERIOD('Sales'[Date],-1,MONTH))  




PriorPeriodSales$ = CALCULATE(sum('Sales'[SalesAmount]),PREVIOUSMONTH('Calendar'[Date]))


in both cases I get a column with no values(no error, just blank), I'm not sure what am I missing. The information on my original table is at a daily level, not sure if that should be a problem?? Please help!



Super User IV
Super User IV

I am guessing that your issue has to do with the comment from the documentation:


"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 is relatively likely that the first date in your current context is not what you desire it to be.



@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Advocate I
Advocate I

I assume you are filtering on the date/month in 'Calendar'[Date] table in which case you need to include ALL('Calendar') as a filter in your calculation.




PriorPeriodSales$ = CALCULATE(SUM('Sales'[SalesAmount]), PREVIOUSMONTH('Calendar'[Date]), ALL('Calendar'))

Advocate V
Advocate V

Hi @aavilap,


Works good for me.

Make sure :

- your date attribute type is "date" or "datetime"

- all relationships on your date table are marked as single direction



Helper I
Helper I

My solution.


Had the same problem - previousmonth returned blanks. Formula syntax was correct but it didnt work. My data was linked to created in Excel calendar ( I'm sure it was perfect, without missing days) but "previousmonth" still didnt work.


Solved it by creating new calendar table inside Power Bi using "Calendar" formula. To make it shorter I've cut it at min and max days in my sales table.


Calendar = CALENDAR( date(YEAR( Min(Sales[Date]) );1;1);
date(YEAR( MAX(Sales[Date]) );12;31))

Despite that this formula gives 100% the same calendar I created in Excel "previousmonth" started to work perfectly once I linked my data to this new calendar.



Special thx to the guy who published this video of how to create this Calendar table in Power BI!

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors