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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Show zeros on days that do not appear in the data set

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
Greg_Deckler
Super User
Super User

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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.