cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Calculating Moving 90 Day sum and plotting on time graph

Hello,

I am trying to calculate a moving 90 day sum that I am then plotting on a graph with the actual months (think June has June, May & April data, May has March, April, and May data etc). My data set is cost data for each product for each month with a number of other measures. I have been attempting this through various versions of the "Calculate(,FILTER( or Calculate(,DatesBetween(" functions with no luck. Has anyone done this before? I also tried calculating a number of custom columns where I would sum the previous month and the month before and add the columns together but that did not work either.

1 ACCEPTED SOLUTION
Employee

This should be close and works for me.  This calculated measure assumes a relationship between the Sales and Dates tables.

```Measure = CALCULATE(
SUM('Sales'[Sales Qty]),
-------------------------------------------------------------------------
DATESINPERIOD('Dates'[Date],LASTDATE('Dates'[Date]),-90,DAY)
)```

Proud to be a Datanaut!

2 REPLIES 2
Employee

This should be close and works for me.  This calculated measure assumes a relationship between the Sales and Dates tables.

```Measure = CALCULATE(
SUM('Sales'[Sales Qty]),
-------------------------------------------------------------------------
DATESINPERIOD('Dates'[Date],LASTDATE('Dates'[Date]),-90,DAY)
)```

Proud to be a Datanaut!

Frequent Visitor

That looks to have worked! Thanks Phil!

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors