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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dilbagsidhu
Frequent Visitor

month to month calculation

hello fellows,

im trying to calculate Month to month expenses change in my dataset, which inculdes one whole year data of expenses for different categories on different dates.


i tried finding previous month expenses using below formula, so that i can finally find month to month change.

BUT im making mistake somehwere.

 

Previous month =
CALCULATE([Total],PREVIOUSMONTH('2024'[Date]))


previousMonth2 =
CALCULATE(SUM('2024'[Amount]),DATEADD('2024'[Date].[Date],-2,MONTH))
 
 
but im not able to getany results, expensestable.pngexpense.png
3 REPLIES 3
dilbagsidhu
Frequent Visitor

@xifeng_L hello, thankyou,  i  created new date table for slicer, and used this measure:

Previous month =
CALCULATE([Total],PREVIOUSMONTH('2024'[Date]),ALL('date'[month]))

now im getting previous month value but shows total value for all categories and subcategories in matrix.expenses3.png

Need more info to judge, can you provide the pbix file?

xifeng_L
Super User
Super User

Hi @dilbagsidhu 

 

It looks like you are using the fact table in the PREVIOUSMONTH function? And it should be the same table as the slicer, right?

 

Since the slicer selects May, then the PREVIOUSMONTH function returns the date of the previous month, but since the slicer restricts the month to May, the intersection of the two will be null, leading to a null final result.

 

You should create a date table and use the dates from the date table in the PREVIOUSMONTH function. But if you want to keep using the fact table that's fine, just remove the month filter of slicer. You can try below measure.

 

Previous month =
CALCULATE (
    [Total],
    PREVIOUSMONTH ( '2024'[Date] ),
    ALL ( '2024'[Month Field of Slicer] )
)

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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