How to display line graph up to a specific month

  Kiến thức lập trình

I want to show in the following line graph the value “Planned” until the month before the current one, that is, we are in the month of June I want to show values only until the month of May but taking into account that as the months go by the graph must move to the following month, and for the value “Actual” I want to show only those that are greater than 0.

The graph is currently displayed as follows:

enter image description here

For this case I would like to only see the value “Planned” until the month of May since we are currently in June, but I reiterate that as we go through the months of the year the graph should change, and for the value “Actual” show only those greater than 0.

I explain in detail how the model is, I have a calculated table of Date that I created with the CALENDARAUTO() function and in addition to this a column to generate the months with the following DAX formula:

Month = FORMAT(Date[Date], "mmm", "en-US")

To display the year filter above the chart, I use the Year column from the calculated Date table that was created with the CALENDARAUTO() function.

“Planned” and “Actual” are two metrics that I am using to generate the bar graph, and in addition to this I have related the Date table to other tables that are the ones I use to generate the metrics that are shown in the bar graph.

An example of what I want to achieve is the following:

enter image description here