cancel
Showing results for
Did you mean:
Regular Visitor

## 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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Member

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

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() )

5 REPLIES 5
Highlighted
Member

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

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() )

Regular Visitor

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

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() )

Member

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

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

Occasional Visitor

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

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?

Frequent Visitor

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

Hi,

Cumulative NSI = IF( MAX('Calendar'[Date]) > TODAY(), BLANK(),
CALCULATE(