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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
springday
Microsoft Employee
Microsoft Employee

Calculate moving average of a measure

Hi,

 

We have a table which calculates a measure per day based on the value of a few columns. Now we want to smooth out the measure  to show the trend over time. We tried to use the moving average formula and it throws error with aggregation function as only the table columns can be used there. 

 

Is this even possible to do in power BI desktop? If not, we'll have to export the data out and caclulate somewhere else? Any ideas how to do this?

 

Thanks for any help on this.

-Amyee

4 REPLIES 4
parry2k
Super User
Super User

@springday Read this post to get your answer quickly.  If you share some sample data, it will help to get you the solution.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Here's the sample table.

 Date                      ID        Level     Speed  Status

1/28/20191002380341
1/28/20192002198290
1/28/20192002198351
1/28/20193002115460
1/28/20194002396221
1/28/20195001438121

dci = level/ ( median speed when status is 1 + median speed when status is 0)

 

 

 

Hi @springday ,

Maybe you can try this measure:

dci = 
VAR x =
CALCULATE(
    MEDIAN(Sheet1[Speed]),
    FILTER(
        Sheet1,
        Sheet1[Status] = 1
    )
)
VAR y = 
CALCULATE(
    MEDIAN(Sheet1[Speed]),
    FILTER(
        Sheet1,
        Sheet1[Status] = 0
    )
)
VAR z =
CALCULATE(
    x+y,
    ALL(Sheet1[Level])
)
RETURN
DIVIDE(
    MAX(Sheet1[Level]),
    z
)

 

Best regards,
Lionel Chen

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

Hmm..., it doesn't seem to sovle the moving average problem. Back to my original question, does Power Bi support moving average of a measure?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors