Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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!
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
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
)
)
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?
Hi, @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]
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |