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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
gmasta1129
Resolver I
Resolver I

Month over month difference

 

Hello,

 

I am trying to find the difference in values month over month.  For example, from 11/30/2021 to 12/31/2021 the difference is 405,906 ( total value usd column 11.30 14,407,600 minus total value usd column 12/31 14,813,506).  This value should show up in the 3rd row under column NAV MOM Diff 2. 

But instead its showing 14,813,506 which is the same number as column total value usd.  

 

 

 

I used the formula below but not sure what i am doing wrong? 

 

NAV MOM Diff 2 = SUM('daily_report (2)'[total value usd])-CALCULATE(SUM('daily_report (2)'[total value usd]),PREVIOUSMONTH('daily_report (2)'[pedate]))

 

gmasta1129_0-1644607589844.png

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @gmasta1129 ,

 

For this type of problem, you need to create a calendar table and link this table to your factual data table by date. You cannot reference the date of the data table directly in the PREVIOUSMONTH function.

M_result =
CALCULATE (
    SUM ( 'Table'[total value usd] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Col_2] = MAX ( 'Table'[Col_2] ) )
)
    - CALCULATE ( [M_sum], PREVIOUSMONTH ( Tab_cal[Date] ) )

vhenrykmstf_0-1644909133484.png

related blog and solution as below:

DAX - PREVIOUSMONTH Function - Power BI Docs

Solved: Error with PREVIOUSMONTH - duplicatedates - Microsoft Power BI Community


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @gmasta1129 ,

 

For this type of problem, you need to create a calendar table and link this table to your factual data table by date. You cannot reference the date of the data table directly in the PREVIOUSMONTH function.

M_result =
CALCULATE (
    SUM ( 'Table'[total value usd] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Col_2] = MAX ( 'Table'[Col_2] ) )
)
    - CALCULATE ( [M_sum], PREVIOUSMONTH ( Tab_cal[Date] ) )

vhenrykmstf_0-1644909133484.png

related blog and solution as below:

DAX - PREVIOUSMONTH Function - Power BI Docs

Solved: Error with PREVIOUSMONTH - duplicatedates - Microsoft Power BI Community


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@gmasta1129 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.