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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hey this should be really simple
I need to show in a table visual the sales by month, but also show the sales for previous month, so in february show Jan sales, in march show feb etc. I tried with "previousmonth" DAX but for some reason didnt work
Solved! Go to Solution.
Hi @krist_pbi - you can create two measures - one for the current month's sales and another for the previous month's sales.
Current Month Sales =
CALCULATE(
SUM(Sales[SalesAmount]),
DATESMTD('Calendar'[Date])
)
Instead of PREVIOUSMONTH, you can use DATEADD to shift the date context by one month
Previous Month Sales =
CALCULATE(
SUM(Sales[SalesAmount]),
DATEADD('Calendar'[Date], -1, MONTH)
)
Replace 'Calendar'[Date] with your calendar table's date column.The DATEADD function shifts the date context to the previous month.
Hope this works in your scenerio
Proud to be a Super User! | |
Measure for Current Month Sales:
Current Month Sales = SUM(Sales[Sales Amount])
Measure for Previous Month Sales
Previous Month Sales = CALCULATE( SUM(Sales[Sales Amount]), PREVIOUSMONTH(Sales[Date]) )
The PREVIOUSMONTH function works correctly only if you have a properly configured date table, and it is marked as a "Date Table" in your model.
Ensure that your Sales table has a relationship with the Date table on the date column.
Place the Month column (from the Date table) on the rows of the table visual.
Add Current Month Sales and Previous Month Sales as values in the visual.
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Hi @krist_pbi - you can create two measures - one for the current month's sales and another for the previous month's sales.
Current Month Sales =
CALCULATE(
SUM(Sales[SalesAmount]),
DATESMTD('Calendar'[Date])
)
Instead of PREVIOUSMONTH, you can use DATEADD to shift the date context by one month
Previous Month Sales =
CALCULATE(
SUM(Sales[SalesAmount]),
DATEADD('Calendar'[Date], -1, MONTH)
)
Replace 'Calendar'[Date] with your calendar table's date column.The DATEADD function shifts the date context to the previous month.
Hope this works in your scenerio
Proud to be a Super User! | |
awesome, exactly what I needed! this was simple and I cannot believe chatgpt couldnt figure it out, thanks a lot!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 49 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 91 | |
| 75 | |
| 41 | |
| 26 | |
| 25 |