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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
0Experience
Helper III
Helper III

Can we set limit (number of lines) on the Line Chart

Hello everyone,

 

I'm currently working on a line chart visualization that plots 5 lines corresponding to different categories in my dataset.

 

0Experience_1-1707227354190.png

 

 

In my demo (don't see any options to attach the power BI file), I have a filter, a column chart, and a line chart. The filter allows me to select all categories, which is crucial for the accuracy of the column chart's results. However, I'm encountering a dilemma with the line chart.

 

Ideally, I'd like to limit the number of lines displayed on the line chart, let's say to just 3, for better clarity and focus. My question is: what's the best approach to achieve this?

 

One option I'm considering is adding another filter specifically for the line chart, where users can select their desired number of categories. But I'm open to suggestions on how to implement this effectively.

 

Alternatively, I'm wondering if there's a way to automatically limit the number of lines on the chart. For instance, if the user selects more than 3 categories, the chart would randomly display any 3 of them. However, if the user specifically selects 1, 2, or 3 categories, only those corresponding lines would be shown. Something like this post.

 

Keep in mind that the filter I mentioned is connected with another chart, where selecting all categories is necessary. So any solution should consider this requirement.

 

Demo Data:

YearCategoryNumber
2022A20
2022B10
2022C22
2022D10
2022E25
2021A10
2021B22
2021C20
2021D15
2021E25
2020A15
2020B14
2020C28
2020D25
2020E26

 

 

I appreciate any insights or recommendations you might have on how to tackle this issue effectively. Thank you for your help!

3 REPLIES 3
Anonymous
Not applicable

Hi, @0Experience 

I'm happy to answer your questions. There is no option to directly limit the number of rows on the chart in Power BI. If we want to limit the number of rows, we can limit the number of rows through measure. For example, if I want to display rows of three categories: A, B, and C, we can do this

Dax formula:

Line = CALCULATE(SUM(Sheet1[Number]),'Sheet1',FILTER(VALUES('Sheet1'[Category]),'Sheet1'[Category] IN {"A","B","C"}))

Put this measure on the Y axis:

9.png

If the user selects more than 3 categories, the chart will randomly display any 3 of them. This feature is not currently available.

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@AnonymousThank you for your response. I understand your concern. Currently, the measure is set up to display only data for A, B, and C. Even if you select multiple options, it will still only show data for A, B, and C.

 

Now, if a user wants to view data for B, D, and E, they won't be able to see D and E on the chart because the measure is configured to only display B.

 

0Experience_0-1707309825631.png

 

vanessafvg
Super User
Super User

can you not share the file with dropbox or another cloud provider and create the link in your post, that way it would be easier to understand what you are asking.

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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