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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
loafers
Frequent Visitor

Measure to show blank if in future period but add 0 to all prior periods if there is no data?

I have a matrix and line graph below with the same measures.

In the matrix, I have months from date table going across and going down are the measures for each year. 

 

In the line graph, I want to have it connected for all months and if there is no data then to connect on the zero. The measure calc is just time intelligence: 

CALCULATE([Revenue],DATESMTD(DATEADD('Date'[Date],0,MONTH)))
 
With the current measure, the line graph will become disconnected if there is a zero as seen below. I can add a +0 to the end of the measure and it will connect for each month. However, the issue with the +0 at the end is that it will show zero for future periods even though they haven't happened yet and I want it to remain blank if there is no data for those periods yet. 
 
This is only an issue for the current year measure since for prior years I'm fine with the +0 at the end. Is there a better way to write the measure so that instead of December at zero (blue line below is current year), it would just show a blank in matrix and the line graph would stop at November for current year until there is actual data?

 

loafers_0-1670447693180.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @loafers ,

 

According to your requirement description, you want to implement 0 for months with no value in the past and blanks for months with no value in the future, right?

If this is the case, you can try modifying this measure to achieve your needs like this:

Measure=
IF(Max('Date'[Date])<eomonth(today,-1)+1,

CALCULATE([Revenue],DATESMTD(DATEADD('Date'[Date],0,MONTH)))+0,blank())

Thank you for your time, if there is a data display problem, you can provide the following .pbix file or data that does not contain sensitive data.

 

Best Regards,

Neeko Tang

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 @loafers ,

 

According to your requirement description, you want to implement 0 for months with no value in the past and blanks for months with no value in the future, right?

If this is the case, you can try modifying this measure to achieve your needs like this:

Measure=
IF(Max('Date'[Date])<eomonth(today,-1)+1,

CALCULATE([Revenue],DATESMTD(DATEADD('Date'[Date],0,MONTH)))+0,blank())

Thank you for your time, if there is a data display problem, you can provide the following .pbix file or data that does not contain sensitive data.

 

Best Regards,

Neeko Tang

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

amitchandak
Super User
Super User

@loafers , Try like

 

0 between range
Measure = var _1= CALCULATE([Revenue],DATESMTD( 'Calendar'[Date]) )  +0
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.