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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Bryanna
Helper II
Helper II

Rolling 12 month average to populate going forward

Hi,

 

I have a use case where I am trying to show a rolling 12 month average but populate the missing data for dates where nothing occured. I figured out how to do the rolling 12 month but it doesnt continue foward.  Any thoughts?

 

See measure below:

Measure 2 =
    VAR NumOfMonths = 12
VAR LastCurrentDate =
    MAX ( 'Calendar Table'[Month End] )
VAR Period =
    DATESINPERIOD ( 'Calendar Table'[Month End], LastCurrentDate, - NumOfMonths, MONTH )
VAR Result =
    CALCULATE (
        AVERAGEX (
            VALUES ( 'Tracker'[Month End Date] ),
            [sum VMS$]
        ),
        Period
    )
VAR FirstDateInPeriod = MINX ( Period, 'Calendar Table'[Month End] )
VAR LastDateWithSales = MAX ( 'Calendar Table'[Month End] )
RETURN
    IF ( FirstDateInPeriod <= LastDateWithSales, Result )
 
Bryanna_0-1711401207783.png

 

 
3 REPLIES 3
Bryanna
Helper II
Helper II

Hi,

 

Its not letting me add the pbi file. The expected output is below where if this were to continue to forward instead of the value being zero it would populate a 12 month average , if there isnt a 12 month average to calculate then it could just pull the last value that was available. I also need this to sum then correctly at the bottom. 

Bryanna_0-1711465485339.png

Current output it is showing anytime there is a blank field it will populate that last value even prior to when the project started. And also is not summing correctly.

Bryanna_0-1711466036037.png

 

 

Anonymous
Not applicable

Hi @Bryanna ,

 

Make sure your Calendar Table contains future dates outside of the current data range.

 

Modify measure to calculate the average for all periods, including periods projected into the future, not the last date of sales.

Measure 2 =
VAR NumOfMonths = 12
VAR LastCurrentDate = MAX ( 'Calendar Table'[Month End] )
VAR Period = DATESINPERIOD ( 'Calendar Table'[Month End], LastCurrentDate, -NumOfMonths, MONTH )
VAR Result = CALCULATE (
    AVERAGEX (
        VALUES ( 'Tracker'[Month End Date] ),
        [sum VMS$]
    ),
    Period
)
RETURN IF ( ISBLANK( Result ), BLANK(), Result )

 

You can also refer to the solution of this case, which may help you with your problem.

Solved: Calculate Rolling 12 Month Average Headcount - Microsoft Fabric Community

 

I would be grateful if you could provide me with sample data for testing, please remove any sensitive data in advance.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.