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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
watje255_ju
Helper III
Helper III

Fix Line Graph for breaks in data, replace blank with 0, then leave blank for months after last sale

Hello, 

 

I have used an IF funtion to replace the blank gross margin % (for months when there is no sales) for 0, so that my line graph doesnt break. 

 

However I then want the months in which there are no sales to return blank, rather than 0, can I please help with this? It seems that when using the IF function blank replacement, all subsequent months are 0, not blank, even when filtering for last sales. 

 

So ideally, the measure, Stop GM% after last sale would be blank from Aug 22 onwards.

 

Measures

 

Thanks!

 

watje255_ju_0-1660627965230.png

https://1drv.ms/u/s!As8wMr9_bgGrgWstsIAjHqF-oJOI?e=WG8HNb PBIX file link here

Thanks!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @watje255_ju 
I hope this is what your looking for https://www.dropbox.com/t/6CtxqpNbKlUr0hd7

1.png

Stop GM % after last sale = 
Var LastSalesDate = CALCULATE ( MAX (Margin[Month] ), REMOVEFILTERS ( ) )
VAR Result = 
    IF ( MAX ( DimDate[DateKey]) <= LastSalesDate, [GM% with 0 replacing blank] ) 
RETURN
    Result

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @watje255_ju 
I hope this is what your looking for https://www.dropbox.com/t/6CtxqpNbKlUr0hd7

1.png

Stop GM % after last sale = 
Var LastSalesDate = CALCULATE ( MAX (Margin[Month] ), REMOVEFILTERS ( ) )
VAR Result = 
    IF ( MAX ( DimDate[DateKey]) <= LastSalesDate, [GM% with 0 replacing blank] ) 
RETURN
    Result

Thank you so much!!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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