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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sidvix917
Helper I
Helper I

I need to optomize my 3 month rolling average measure. It is not loading the visual.

Hello,

 

I have been working on this report for some time and have used this forum to resolve a few issues with my successful measures! I am in the final phase of publishing the report; however, one of the visualizations displays the error 'Visual has exceeded the available resources', preventing it from loading. I have determined that one of the measures is consuming a great deal of memory, and that this measure is linked to multiple other measures. I have listed all the measures in sequence, beginning with the main one.

 

3 Month Rolling Average =
CALCULATE(AVERAGEX(VALUES(Dates[Month & Year]),[Last Date with Data]),DATESINPERIOD(Dates[Date],MAX(Dates[Date]),-3,MONTH))

Last Date with Data =
if(MIN(Dates[Date])>[Date till which data is available],BLANK(),[Last Non Blank Value])
 
Date till which data is available = MAXX(ALL(Dates),[Date Value])
 
Date Value = MAX(Query1[observations.date])
 
Last Non Blank Value =
Var Last_Date =
CALCULATE(MAX(Dates[Date]),
FILTER(ALL(Dates), Dates[Date] <= MAX(Dates[Date]) &&
Query1[Total Sales Values] <> 0))

return
CALCULATE([Sales Value], FILTER(ALL(Dates),Dates[Date] = Last_Date))
 
Total Sales Values = CALCULATE(sum(Query1[observations.value]),USERELATIONSHIP(Query1[observations.date],Dates[Date]))
 
Sales Value = SUM(Query1[observations.value])
 
 
I would appreciate assistance in optimizing this. Thank you very much.
3 REPLIES 3
amitchandak
Super User
Super User

@sidvix917 , Try window function can help

 

example

 

Rolling 3 = CALCULATE([Net], WINDOW(-2,REL, 0, REL, ADDCOLUMNS(ALLSELECTED('Date'[Month Year],'Date'[Month Year Sort] ),ORDERBY([Month Year Sort],asc)))

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit,

 

What are you referring to [Net]? And do I discard all other measures that I have mentioned?

The above window function you had given did not work. I am pasting the measure that I was using once again. It does not load the visual when I Publish the report online. It works on the Power BI desktop, but it is prolonged.

Last Non Blank Value =
Var Last_Date =
CALCULATE(MAX(Dates[Date]),
FILTER(ALL(Dates), Dates[Date] <= MAX(Dates[Date]) &&
Query1[Total Sales Values] <> 0))

return
CALCULATE([Sales Value], FILTER(ALL(Dates),Dates[Date] = Last_Date))

3 Month Rolling Average =
CALCULATE(AVERAGEX(VALUES(Dates[Month & Year]),if(MIN(Dates[Date])>MAXX(ALL(Dates),MAX(Query1[observations.date])),BLANK(),[Last Non Blank Value])),DATESINPERIOD(Dates[Date],MAX(Dates[Date]),-3,MONTH))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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