Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello! Attempt to calculate the sales of the previous month using this function:
SP= CALCULATE ( SUM ( Table1 [number ] ) ; previousMonth (Table 2 [DATA ] ) )
However, the function does not return values
Solved! Go to Solution.
Finally you can use your measure:
SP= CALCULATE ( SUM ( Table1 [number ] ) ; previousMonth (CalendarTable [DATE ] ) )
This particular exession requires a date table related to the fact table. Are you using a date table?
Check out this link
http://www.mrexcel.com/forum/power-bi/842725-previous-month-date-dax-syntax.html
Proud to be a Super User!
Thank you for answering!
i have a data table and a data fact, how ever no relationship was detected!
Hi, can you post a screenshot with tables and relationship?.
Hi @Estefania89 you need a date Table with each day like a calendar.
To create a calendar table you can use:
Create a new Table (From Modeling)
CalendarTable=Calendar("01/01/2015";31/12/2016") you can change the dates according to your tables.
Next, create a relationship between date columns on your tables and Calendar Table.
Finally you can use your measure:
SP= CALCULATE ( SUM ( Table1 [number ] ) ; previousMonth (CalendarTable [DATE ] ) )
Perfect!
It works now. Thanks so much for all your help!
Hi,
I have the same problem but I already have a date table.
I linked it to my sales table. The SAMEPERIODLASTYEAR function works properly but the PREVIOUSMONTH function is not working. It's giving me a blank column. Please help !
Thank you !
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |