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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Assign Missing Dates With Zero for Value

Hi,

I have a list of [Projects] each project has a [Date] and a [Value].

The dates are by month, eg. 2014-12-01

Some of the projects don't have any data for some months. I need them all to show all 12 months of each year back to 2014, and just display a value of 0 for the months that didn't contain data.

I can't think of a way to do this easily.

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Perhaps you need the IF function to replace the missing date with 0.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

@v-diye-msft 

@amitchandak 

So I tried creating a date table, but I'm not sure how I would merge that with the projects table to get the missing values in there.

Here is my DAX for the 3 month moving average measure:

3 Month Average = 
CALCULATE(
    AVERAGEX( projects, projects[Value]),
    DATESINPERIOD(
        projects[Date],
        LASTDATE(projects[Date]), -3, MONTH
    )
)

Is there a way I can build in an IF statement that says If there is no value for a month, use a zero rather than the next available month? Right now, if there was no data for July or June it would calculate the average as (August+May+April)/3. I want it to do (August+0+0)/3.

Hi @Anonymous 

 

Why don't try to replace the null with 0 in query editor?

 

003.PNG

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

@v-diye-msft 

There are no nulls. If a record was not created for the project on that day, then nothing got recorded. This is in Dynamics btw.

amitchandak
Super User
Super User

Try this workaround, Create a Month year calendar.

1. If you join it, in formula use crossfilter 

2. If you do not join, then it should give you all  month

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors