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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
C4L84
Advocate II
Advocate II

Line graph with blank values for future months

Hi community,

 

I'm having some trouble with a line graph showing blank values:

 

C4L84_0-1657030395241.png

As you can see the financial year runs from March to February. In this instance there were no sales in February 2021 so there is no point plotted on the graph, however I need to show this as 0.

I used the following DAX to plot this point on the graph:

Spend (no blanks) =

VAR Spend = SUM('Invoiced Sales'[Spend])

RETURN

IF(ISBLANK(Spend), 0, Spend)
 
The result is this:
C4L84_1-1657030554824.png

 

Now I have an issue with how future months, eg July-February 2022 are showing a line at 0.

 

How do I keep the point for Feb 2021 but drop the future month points from the graph?

 

Here is the pbix file.

 

Thanks!

1 ACCEPTED SOLUTION
C4L84
Advocate II
Advocate II

Hi amitchandak, thanks for your reply.

 

It didn't work because it is using the max date from the calendar rather than the last day of the previous month.

I used SQL & power query to define this and then used your measure and it worked.

 

For anyone else that is having this problem, here's the pbix with the solution.

View solution in original post

2 REPLIES 2
C4L84
Advocate II
Advocate II

Hi amitchandak, thanks for your reply.

 

It didn't work because it is using the max date from the calendar rather than the last day of the previous month.

I used SQL & power query to define this and then used your measure and it worked.

 

For anyone else that is having this problem, here's the pbix with the solution.

amitchandak
Super User
Super User

@C4L84 , Try to control like

 

0 between range
Measure = var _1= SUM(Opportunity[Opportunity count]) +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))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

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

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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