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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
OhLookAnError
Helper I
Helper I

Rolling sum between relative dates?

Hello! I am trying to get a rolling sum between two dates. Normally I would use something like the statement below to just get for example the last 365 days:

 

Revenue Prior 365 Days= Calculate(SUM(tblSummary[Revenue]),

                DATESINPERIOD(tblSummary[ReportDate],

                LASTDATE(tblSummary[ReportDate]),-7,DAY))

But, now I need to get a rolling sum for prior 365 before the current prior 365 days... if that makes sense.... Just not sure how to work a second filter in there so that i can get a rolling date period where one of the dates isnt just the last date in the report. 

 

Thanks in advance! 

5 REPLIES 5
some_bih
Super User
Super User

Hi @OhLookAnError please describe "how" you model you inputs for this wanted output, like do you use slicer of you just want measure depending on ...is 365 fixed all time or this is just year...if possible share model to better understand your model





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Hi, it is just going in a table. So for example, the first column would show the sum of the last 90 days and the next column would show the sum of the 90 days before that. 

Hi @OhLookAnError  possible solution as measure

Running sum test =
CALCULATE (
SUM(tblSummary[Revenue]),
DATESINPERIOD (
'Date'[Date], --this column must be Calendar / Date table in Power BI
MAX ( 'Date'[Date] ),--this column must be Calendar / Date table in Power BI
-1, --change as needed
YEAR --period could Day, Month, Quarter, Year
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






I got this below to work but is there a way to do it in months instead of days?

 

PreviousPeriod = Calculate(SUM('tbl'[Revenue]),
        DATESBETWEEN('Calendar'[Date],
        MAX('Calendar'[Date]) - 180,
        MAX('Calendar'[Date]) -90))

Hi, @OhLookAnError 

@OhLookAnError 

 

 

try below 

just adjust your column name

rolling sum for 90 days

 

365 Days =
Calculate(
    SUM(tblSummary[Revenue]),
      tblSummary[ReportDate]> max(tblSummary[ReportDate])-90 &&
            tblSummary[ReportDate]<=max(tblSummary[ReportDate]
          )


 

rolling sum for 365 days

365 Days =
Calculate(
    SUM(tblSummary[Revenue]),
      tblSummary[ReportDate]> max(tblSummary[ReportDate])-365 &&
            tblSummary[ReportDate]<=max(tblSummary[ReportDate]
          )

 

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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