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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mj2024
Helper II
Helper II

how to remove some entries in the legend?

Hi

 

I have a line chart with multiple values on it.  There is legend at the top that is too long.  It is listing out all the values I used.  I still want the values to appear as line chart but I don't want the labels to appear at the top.  Is there a way to hide the ones I don't want to see?  I created the chart by putting the values into the Y-axis box in the line chart visual.  I did not use the Legend box.

 

Screenshot 2024-12-21 215202.png

 

Thank you

1 ACCEPTED SOLUTION

Hi @mj2024 ,

 

Here I have a easy way, you may try Field parameter.

In my sample there are five measures. I only need to show Measure1/3/5 and hide Measure2/4.

We can use the Field Parameter function to prioritize the measures that need to be shown when adding measures, and add the ones that need to be hidden afterwards.

Here we add Measure1/3/5 first and add Measure2/4 afterwards.

vrzhoumsft_0-1735024602630.png

Field Parameter will sort the measure according to the order we add it.

vrzhoumsft_1-1735024979326.png

Create a Line chart.

vrzhoumsft_2-1735025050124.png

Then Insert a rectangle from Shapes. Set the color of it as white. 

vrzhoumsft_3-1735025067672.png

Move it to hide the legends we don't need. Result is as below.

vrzhoumsft_4-1735025136363.png

 

Best Regards,
Rico Zhou

 

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

View solution in original post

11 REPLIES 11
mj2024
Helper II
Helper II

Hi @danextian 

Can you help me with this?  The scales are off when I follow your steps. Is there a way to prevent the scale from changing when the legend is removed?

Thank you

Hi @mj2024 ,

 

Here I have a easy way, you may try Field parameter.

In my sample there are five measures. I only need to show Measure1/3/5 and hide Measure2/4.

We can use the Field Parameter function to prioritize the measures that need to be shown when adding measures, and add the ones that need to be hidden afterwards.

Here we add Measure1/3/5 first and add Measure2/4 afterwards.

vrzhoumsft_0-1735024602630.png

Field Parameter will sort the measure according to the order we add it.

vrzhoumsft_1-1735024979326.png

Create a Line chart.

vrzhoumsft_2-1735025050124.png

Then Insert a rectangle from Shapes. Set the color of it as white. 

vrzhoumsft_3-1735025067672.png

Move it to hide the legends we don't need. Result is as below.

vrzhoumsft_4-1735025136363.png

 

Best Regards,
Rico Zhou

 

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

mj2024
Helper II
Helper II

I figured out how to make the backgrounds transparent so if I overlay one then I can see both.  The problem is that the scales are off.  Once I remove the legend then the scale increases to fill up the missing space.  The Y-axis scale for both with legend and and without legend needs to always be the same.  How can I do this?

mj2024
Helper II
Helper II

Its not working for me.  Does someone have a video that shows what to do?

Tahreem24
Super User
Super User

@mj2024 Follow these steps:


Step 1: First take your actual visual where you want to show everything. But hide the title of this visual:

 

Tahreem24_0-1734936864066.png


Step 2: Take another line chart visual and do the following setting as per below screenshot and do not hide the title for this chart. And off course keep the those legend values which you only want

 

Tahreem24_1-1734937158612.png


Step 3: Arrange both these visuals as shown in below screen shot:

Tahreem24_2-1734937542192.png

 

Step 4: Final result is...

Tahreem24_3-1734937648007.png

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
mj2024
Helper II
Helper II

Thank you @danextian 

there is no legend in my chart:

Screenshot 2024-12-22 144955.png

What do you suggest I do?

Those individual measures will still be treated as a legend. If you want to exclude one of them from the legend without removing its own line, please refer to my initial reply.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Idrissshatila
Super User
Super User

Hello @mj2024 ,

 

so you have this visual that has all data 

Idrissshatila_0-1734881231271.png



you go to filter pane and select the legend field (example country as in screenshot), then unselect the ones you dont want to show.

 

Idrissshatila_1-1734881293487.png

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




danextian
Super User
Super User

Hi @mj2024 

 

The only time you can exclude a legend tied to a visual if the value for that legend returns blank or you exclude through filters. What you can do is use two separate visual :

  • Copy the visual
  • Disable the legend from the original
  • Turn Reponsive from General tab of the visual
  • Exclude the category value you want to be exluded
  • Layout the two visuals so seem to appear as one.









Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian 

I followed your steps.  There are two copies of the visual but when I overlay them then one covers the other so I cannot see the one that is below it.  What do you suggest?

Thank you

Make sure the viz that has the legend has Responsive turned off and then resize it.

danextian_1-1734950600751.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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