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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Frequent Visitor

Rolling average for past 30 days in minutes

How do I create a 30-day rolling average field to account for timestamp (each minute). So far it makes sense for my current rolling average field to show the 30 day rolling average for each date, but not each minute. When I add timestamp to the table, it throws the rolling average off. Any thoughts on how I can do that







Rolling_Average =
VAR NumDays = 30
Var RollingSum =
DATESINPERIOD(Query1[Date], LASTDATE(Query1[DATE]), -NumDays, DAY), ALL(Query1[Timestamp])

Solution Sage
Solution Sage

First off, when using time-intel functions in PBI you have to have a well-formed dates table and you don't. Please consult the docs on DATESINPERIOD. If you follow Best Practices, this might resolve your problem right away. Seriously.

Community Support
Community Support

Hi @woofwoof123 ,

I think you can try this code.

Rolling_Average =
    AVERAGE ( Query1[LAST_FILL]),
    FILTER (
        ALL ( 'query' ),
        'query'[Date] <= MAX ( 'query'[Date] )
            && 'query'[Date]
                > MAX ( 'query'[Date] ) - 30


If I have misunderstood your meaning, please provide a pbix file without privacy information and more details with your desired output.


Best Regards

Community Support Team _ Polly


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


Attaching this image above to use as a "reference". Instead of EMA (Exponential Moving Average), I want just a 30-day moving average vs Intraday data. 

the file is connected to a database connection and is too large to share. But essentially I am trying to have something like a 9am-5pm graph that shows today's "LAST_FILL" and the past 30days rolling average in minutes. Not days... but minutes. Minutes, because the data is in minutes. 






So I want it to look like LAST_FILLS per minute 9-5 intraday vs. average LAST_FILLS of past 30 days in minutes. 

Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors