cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

## Plot moving average on every day of year

I have a table with several columns. One column is the date. Another column is the plant. Another column is the daily production. I want to plot the 10-day moving average of the daily production for a specific plant that the user can select, factoring in zero daily production for days when the plant did not produce. If the plant did not produce on a particular day, there is no record of production (data will not appear with zeros in my data set). I want the horizontal axis of my chart to show me all the days of the year. What is a good way to achieve this goal?

My attempt was to create a measure

Measure = CALCULATE(SUM(production,DATESINPERIOD(dates,LASTDATE(dates)),-10,DAY))/10

That seems to work on the days when the plant produced something, but it only returns values on the days when the plant produced , whereas I want the measure to be calculated on every single day, factoring in zeros for days when there are no records of production for the plant. I have tried changing continuous/categorical x-axis but that does not fix it.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Plot moving average on every day of year

FYI, I don't understand the logic of creating the same post 3 times with different titles...

### I have book! Learn Power BI from Packt

Proud to be a Datanaut!

2 REPLIES 2
Super User

## Re: Plot moving average on every day of year

FYI, I don't understand the logic of creating the same post 3 times with different titles...

### I have book! Learn Power BI from Packt

Proud to be a Datanaut!

Regular Visitor

## Re: Plot moving average on every day of year

Apologies, it was totally unintended. I had trouble receiving the email verification email (due to email filters of my employer) when I first signed up and I uploaded the post three times by mistake (with different titles unintendedly)

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 6 members 1,495 guests
Recent signins: