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

View all the Fabric Data Days sessions on demand. View schedule

Reply
audreyf
New Member

Rolling SUM with Expiration Date

I am trying to get a rolling measure and I am struggling to get the desired results. Below is an example of the data I am trying to summarize. 'Start' has a N:1 relationship with the Date table. My goal is to sum "Column" as long as the month is within the periods. 

StartEndColumn
3/9/20206/17/2020100
3/16/20206/30/202040
3/19/20204/3/202060
4/3/20204/10/202020
4/6/20204/17/202080
4/6/20204/17/202080
4/6/20205/22/202025
4/16/20204/21/20200
4/21/20205/21/202060
5/11/20205/15/202015
6/4/20206/8/20205
7/1/20208/31/202080


An example of the output would be grouped on the month in the date table:

March-20200
April-20465
May-20240
June-20145
July-2080


I can get the column to sum in a cumulative fashion, with the below DAX, but I cannot seem to use the inverse with "End" to drop the values expired, because for example, March has some values that should carry until June, while others should be dropped in April, so it seems to drop one or the other. 

 

Measure = 
CALCULATE(
	SUM('table'[Column]),
	FILTER(
		ALLSELECTED(Dates[Date]),
		ISONORAFTER(Dates[Date], MAX('table'[Start]),DESC)
))

 

 I could use some direction on a better approach. 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression instead.  This got your desired result in a table visual with the YearMonth column from the Date table.

 

Total Between =
VAR mindate =
MIN ( 'Date'[Date] )
VAR maxdate =
MAX ( 'Date'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Column] ),
ALL ( 'Table' ),
'Table'[Start] <= maxdate,
'Table'[End] >= mindate
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression instead.  This got your desired result in a table visual with the YearMonth column from the Date table.

 

Total Between =
VAR mindate =
MIN ( 'Date'[Date] )
VAR maxdate =
MAX ( 'Date'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Column] ),
ALL ( 'Table' ),
'Table'[Start] <= maxdate,
'Table'[End] >= mindate
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat Thank you! The exact outcome I needed. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.