Forum Discussion
Line Chart with Two Lines and One only displaying data for Months selected
Okay. I goofed up on the original question. Let me restate the issue.
The data being displayed is a YTD value per month of budget and actual amounts.
What we want is, if the user selects 2025 as the year and February as the month, the line chart will display 12 months of target data and two months of actual data. Again, the amounts are YTD. I understand why it's displaying 12 months of actual data by default. But, if there's a way to cut off the actual line at the month selected by the slicer so it only shows a line from period 1 until the selected month, that's what is desired.
In the chart below, the bottom line is the YTD actual amount. It is showing 12 months of data but we want it to stop at the selected month. The top line, the YTD budget amount, should display 12 months of data.
In this case, all months were selected because I can't find a way to display 12 months of budget data and X months of actual data.
- gmsamborn1 year ago
Super User
Hi callenbkd
Would the following measures help? (Note that I added a date table.)
Actual = CALCULATE( SUM ( 'Table'[Amount] ), 'Table'[Scenario] = "Actual" ) Budget = CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Scenario] = "Budget" ) Actual YTD = CALCULATE( [Actual], DATESYTD( 'Date'[Date] ), 'Date'[MonthNo] <= MAX( 'Month'[Month] ) ) Budget YTD = CALCULATE( [Budget], DATESYTD( 'Date'[Date] ) )Let me know if you have any questions.
Sample Show Actual And Budget - 2.pbix