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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
eyz
New Member

DAX: Drill Up / Down averages with missing data in time series

I have a dataset that looks like the following:

DateCategoryValue
1/31/2018A1
2/28/2018A1
3/31/2018A1
4/30/2018A1
5/31/2018A1
6/30/2018A1
7/31/2018A1
8/31/2018A1
9/30/2018A1
10/31/2018A1
11/30/2018A1
12/31/2018A1
1/31/2019A1
2/28/2019A1
3/31/2019A1
4/30/2019A1
5/31/2019A1
6/30/2019A1
7/31/2019A1
8/31/2019A1
9/30/2019A1
10/31/2019A1
11/30/2019A1
12/31/2019A1
1/31/2018B1
2/28/2018B1
3/31/2018B1
4/30/2018B1
5/31/2018B1
6/30/2018B1
7/31/2018B1
8/31/2018B1
9/30/2018B1
10/31/2018B1
11/30/2018B1
12/31/2018B1
1/31/2019B1

 

As you can see, Category A spans the full 2 years while Category B only shows up once in 2019 (in January). When I plot both series and use the "Drill Up" function, we see the following:

eyz_0-1710952962740.png

eyz_1-1710952989069.png

 

In 2019 Q1, we see that the average for B = 1. But I would like the average for B in 2019 Q1 to be 1/3, like the following:

eyz_2-1710953036034.pngeyz_3-1710953050195.png

(Since B only shows up in January 2019).

(Formula for the measures that I am plotting: value = average('data'[A]) )

 

I was able to get the 2nd plot by manually adding B = 0 entries for Feb 2019 through Dec 2019, but was wondering: does anyone know of a DAX solution that doesn't require manual intervention? (Perhaps by way of inserting 0s by itself...) Any help is much appreciated, thanks!

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

To report on things that are not there you need to use disconnected tables and/or crossjoins. So in your case you would need a disconnected calendar table.

 

View solution in original post

Anonymous
Not applicable

Hi @eyz ,

@lbendlin  provided a good idea, and I have another method here, I hope it will be helpful to you.


1. In the power query editor, select the category column and pivot it.

vkaiyuemsft_0-1710998013448.png

 

vkaiyuemsft_1-1710998013449.png

2. Select replace values and replace null with 0.

vkaiyuemsft_2-1710998027330.png

 

3. The final result is shown in the figure below.

vkaiyuemsft_3-1710998042880.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @eyz ,

@lbendlin  provided a good idea, and I have another method here, I hope it will be helpful to you.


1. In the power query editor, select the category column and pivot it.

vkaiyuemsft_0-1710998013448.png

 

vkaiyuemsft_1-1710998013449.png

2. Select replace values and replace null with 0.

vkaiyuemsft_2-1710998027330.png

 

3. The final result is shown in the figure below.

vkaiyuemsft_3-1710998042880.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

lbendlin
Super User
Super User

To report on things that are not there you need to use disconnected tables and/or crossjoins. So in your case you would need a disconnected calendar table.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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