Forum Discussion
GosiaPio2506
1 year agoRegular Visitor
Running Sum Formula Not Working
Hi All, I have an issue with my running sum formula. My result is supposed to be the sum from the past 3 months. For example, in April, I want to get the sum for the period Jan-Mar; in May, I want t...
- 1 year ago
Hi,
No, we decided to go with different approach and not calculate this in Power BI. I believe that there is an issue with the data and this is why the formulas are not working.
Thank you!
aduguid
1 year agoMemorable Member
Try this DAX
Running Sum Test =
VAR currDate = MAX('Sales'[Date])
VAR startDate = EDATE(DATE(YEAR(currDate), MONTH(currDate), 1), -3)
VAR endDate = EOMONTH(currDate, -1)
VAR period = DATESBETWEEN('Sales'[Date], startDate, endDate)
RETURN
CALCULATE(
SUM('Sales'[Net Amount]),
FILTER(
ALL('Sales'[Date]), // ensures proper context removal
'Sales'[Date] IN period
)
)