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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
callenbkd
Helper I
Helper I

Line Chart with Two Lines and One only displaying data for Months selected

I'm trying to create a line chart that compares actuals to budget by month. 

 

I want the actual months to only show the line for the months from 1 to the month selected whereas the budget data would show all months for the year. 

There are other charts on the report that will only be used to display a specific period's data and there are slicers for year and period. 

 

If the user selects February, the line chart would show 12 months of budget data for the selected year and two months of actual data. 

Is there a way to do that even if the user selects a specific month from the slicer? 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@callenbkd good solution from @gmsamborn but to avoid flat line for actual, use following measure:

 

Actual YTD = 
    CALCULATE(
        [Actual],
        DATESYTD ( 
            CALCULATETABLE ( VALUES ( 'Date'[Date] ),  'Date'[MonthNo] <= MAX( 'Month'[Month] ) ) 
         )
    )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

16 REPLIES 16
v-achippa
Community Support
Community Support

Hi @callenbkd,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @parry2k and @gmsamborn for the prompt response.

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the super user resolved your issue.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @callenbkd,

 

We wanted to kindly follow up to check if the solution provided by the super user resolved your issue.

If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @callenbkd,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the super user resolved your issue.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

callenbkd
Helper I
Helper I

Somehow, I did not see the additional responses. I don't know how I missed them. I'll give them a shot. 

parry2k
Super User
Super User

If you read all the replies I already gave the solution for it. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

callenbkd
Helper I
Helper I

Thank you for your help. I didn't see the response until today. The misunderstanding here is it appears the amounts are based on the period selected. However, what the amounts should be are the YTD amounts. When changing the amounts to YTD amounts, the actual line displays for all periods. I want it to stop at the selected month. 

parry2k
Super User
Super User

@callenbkd good solution from @gmsamborn but to avoid flat line for actual, use following measure:

 

Actual YTD = 
    CALCULATE(
        [Actual],
        DATESYTD ( 
            CALCULATETABLE ( VALUES ( 'Date'[Date] ),  'Date'[MonthNo] <= MAX( 'Month'[Month] ) ) 
         )
    )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

 

Thanks for that.  After-re-reading, I realize that I had the requirement wrong thinking they wanted to see the flat line.

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
callenbkd
Helper I
Helper I

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. 

 

Power BI Line Chart Display.png

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

 

 

gmsamborn_1-1741984274156.png

 

Let me know if you have any questions.

 

Sample Show Actual And Budget - 2.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
callenbkd
Helper I
Helper I

There is also a date table. They use a standard calendar year. The date table has a year colum and a month column, in addition to the date column. 

parry2k
Super User
Super User

@callenbkd I have already provided the solution, not sure what this sample data is?

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

callenbkd
Helper I
Helper I

parry2k
Super User
Super User

@callenbkd See attached (page2), demo how you can achieve this, tweak the solution as you see fit.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

callenbkd
Helper I
Helper I

Here you go. This is sample data I created. 

 

ScenarioDateAmount
Budget1/1/20251000
Budget2/1/20251200
Budget3/1/20251300
Budget4/1/20251400
Budget5/1/20251500
Budget6/1/20251640
Budget7/1/20251760
Budget8/1/20251880
Budget9/1/20252000
Budget########2120
Budget########2240
Budget########2360
Actual1/1/2025900
Actual2/1/20251250
parry2k
Super User
Super User

@callenbkd could you share sample pbix file, share using one drive/google drive. make sure to remove any sensitive information before sharing, maybe create some dummy data.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

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