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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to make Line Chart stop mid-graph for future dates

I've made a line chart showing 3 lines, each is a Percentage (y-axis) over Time (x-axis):

1. A "goal" line that has pre-populated data (see black line below)

2. Two data lines showing progress related to that goal (red and green lines below)

 

The data lines do not have values for future dates and I'd like that line just to stop mid-graph after today's date.  But, I can't figure out how because I want the goal line to continue into the future.

 

I'm importing data from Excel and have tried 0's for future values, but that looks bad as the line just jumps down to the x-axis where y=0 (see screenshot below).  And I've tried blanks ("") and NA() values in Excel, but they cause an data mismatch error in Power BI because it's set to a Percentage.

 

PBIDesktop_2017-03-07_08-53-58.jpg

1 ACCEPTED SOLUTION

Hi Jason,

 

Happy to help. If this is a numerical column then you might want to try using the BLANK() function. My first thought would be to write an IF statement asking of the Date on your axis is less than or equal to today's date. If true then it would return the value from your formula, if false it would return BLANK(). So something potentially like this. Let me know if this helps or gets you closer.

 

=IF( Table[Date] <= TODAY(), [Formula], BLANK() )

View solution in original post

5 REPLIES 5

Hi Jason,

 

Happy to help. If this is a numerical column then you might want to try using the BLANK() function. My first thought would be to write an IF statement asking of the Date on your axis is less than or equal to today's date. If true then it would return the value from your formula, if false it would return BLANK(). So something potentially like this. Let me know if this helps or gets you closer.

 

=IF( Table[Date] <= TODAY(), [Formula], BLANK() )

Anonymous
Not applicable

This is great, thanks so much @Reid_Havens!  Bottom line is, I was trying to do too much data prep in Excel, when I should have just done it in Power BI.

 

The one tweak I had to make to your formula was to make the Logical Test of the IF statement an OR to ensure my "Goal Line" is included for the future dates.   So, it's something like:

 

=IF( OR( Table[Date] <= TODAY(), Table[Name]="Goal"), [Formula], BLANK() )

Fantasic. Good evolution of the formula and glad you were able to find a solution.

Hi, I have managed to get my cumulative measure to stop at a particular point (Cost Period = 4) and fill the future with BLANK()

 

However when plotting using Line Chart the Yellow line just goes horizontal (flat line) even though values are BLANK.

 

Can anyone advise what I am doing wrong?

 

Cumulative - STOP mid-graph.PNGMax Cumulative Earned Cuttoff.PNG

 

Hi,

Please check this DAX measure:

 

Cumulative NSI = IF( MAX('Calendar'[Date]) > TODAY(), BLANK(),
CALCULATE(
SUM(AllBusinessSales[NSI]),
FILTER(
ALLSELECTED( 'Calendar' ),
'Calendar'[Date] <= MAX('Calendar'[Date])
)
)
)
 
The trick is to put BLANK() after today.
 
 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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