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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Olia
Helper III
Helper III

PreviousMonth difference

Hi everyone,

 

I'm using the following formula (taken from this forum btw) as a measure

 

Change GC = sum('Sheet'[Group Amount]) - CALCULATE(sum('Sheet'[Group Amount]),PREVIOUSMONTH('Sheet'[Date]))

 

But when checking if it really shows the Change between months, I get this...

 

change.PNG

 

This is not correct. Change should be $8.96

 

 what am I doing wrong?

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Olia
Helper III
Helper III

I got it!!!!

 

For anyone with same error: the problem is that Previous month returns 0, unless you add an extra .[Date] at the end of the formula (don't ask me why, plz)

 

so for some reason, it looks like this:

 

CALCULATE(sum('Sheet'[Group Amount]),PREVIOUSMONTH('Sheet'[Date].[Date]))

View solution in original post

v-lili6-msft
Community Support
Community Support

 

Hi@ Olia 

When you use time intelligence function ,you  need a date table  and create relationship between them like below:

33.PNG3.png

 

Then create measure:

Change GC = CALCULATE(SUM(Table2[Qty]))-CALCULATE(sum(Table2[Qty]),PREVIOUSMONTH('Date'[Date]))

 

Result:

4.png

 

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
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-lili6-msft
Community Support
Community Support

 

Hi@ Olia 

When you use time intelligence function ,you  need a date table  and create relationship between them like below:

33.PNG3.png

 

Then create measure:

Change GC = CALCULATE(SUM(Table2[Qty]))-CALCULATE(sum(Table2[Qty]),PREVIOUSMONTH('Date'[Date]))

 

Result:

4.png

 

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Olia
Helper III
Helper III

I got it!!!!

 

For anyone with same error: the problem is that Previous month returns 0, unless you add an extra .[Date] at the end of the formula (don't ask me why, plz)

 

so for some reason, it looks like this:

 

CALCULATE(sum('Sheet'[Group Amount]),PREVIOUSMONTH('Sheet'[Date].[Date]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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