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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AlexIsac16
Regular Visitor

Sum Difference between different date intervals

Hi everyone,

 

I'm trying to create a measure that calculates the % increase/decrease between the sum of operating profit month to date, and the sum of operating profit during the same time period last month. 

 

Untitled.png

 

The first part of the formula is pretty straigthforward using the TotalMTD function. Could anyone tell me how to create a dynamic measure that calculates the sum of profit between this day last month and the start date of last month? 

 

Thank you,

 

Alex

 

1 ACCEPTED SOLUTION
sjoerdvn
Super User
Super User

You haven't mentioned the table and column names, but it should be something like this.

 

profit last month td = CALULATE(SUM(fact_table[sales]),DATEADD(DATESMTD('date_table'[date]),-1, MONTH))

 

 

View solution in original post

4 REPLIES 4
sjoerdvn
Super User
Super User

You haven't mentioned the table and column names, but it should be something like this.

 

profit last month td = CALULATE(SUM(fact_table[sales]),DATEADD(DATESMTD('date_table'[date]),-1, MONTH))

 

 

Thank you @sjoerdvn, somebody on a different forum suggested the exact same solution and it worked.

Anonymous
Not applicable

Hi  @AlexIsac16 ,

I created some data:

vyangliumsft_0-1695105484597.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _today=TODAY()
var _date=DATE(YEAR(_today),MONTH(_today)-1,1)
var _laststart=
MINX(
    FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(_date)&&MONTH('Table'[Date])=MONTH(_date)),[Date])
var _lastcurrent=
DATE(
   YEAR(_today),MONTH(_today)-1,DAY(_today))
return
SUMX(
    FILTER(ALL('Table'),
    'Table'[Date]>=_laststart&&'Table'[Date]<=_lastcurrent),[Value])

2. Result:

vyangliumsft_1-1695105484598.png

 

 

Best Regards,

Liu Yang

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

Mahesh0016
Super User
Super User

@AlexIsac16 Please can you elaborate visually?

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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