Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Simple way to find data from previous month without creating a DATA table

Hey Guys. 

Right now I am attempting to compare the current month with the previous 

 

I have variable called MonthlyCount and a month variable called "Month".

Through DAX i could easily extract the data belonning to the current month:

 

CALCULATE(SUM('CountTable'[TotalCountPerMonth]),('CountTable'[Month])=MONTH(TODAY()))
 
Now I want to ask how can I do the same with the previous month? I have seen many suggestion and attempts where people create local DATA tables which I really dont want to for practical reasons. Is there a way of extracing the previous month's data with (-1) of currentmonth fx? 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I found a fix!

 

CALCULATE(SUM('CountTable'[Counts]),('CountTable'[Month])=MONTH(TODAY())-1)
This DAX measure will take the total values filtering the previous MONTH!
And thus I also can avoid using the DATE Table

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous ,Prefer to use time intelligence with date table.

 

Example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value = CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))

diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

 

I added a Calender/Data table and tried all your measures, but I still dont seem to be getting the correct data from previous month. I get a far higher value when using; 

previous month value = CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))

 

Anonymous
Not applicable

I found a fix!

 

CALCULATE(SUM('CountTable'[Counts]),('CountTable'[Month])=MONTH(TODAY())-1)
This DAX measure will take the total values filtering the previous MONTH!
And thus I also can avoid using the DATE Table

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.