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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Mk60
Resolver I
Resolver I

Single Legend for multiple visuals?

In case where legend naming convention is taking lot of visual space, is there a way to create a single Legend for all three visuals, in order to get more free space for each donut visual, like in the example here for my legend "Portfolio Type"? Can I create one Legen and place it below the three individual visuals?

Please advise. Thanks much!

Mk60_0-1743541121122.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Mk60 ,
Thanks again for following up! you are right .The Matrix visual doesn’t support cell-level conditional formatting, which is why that black dot still shows up.
The Table visual does allow individual cell formatting, which is why the color blends work better, especially with the dot or space trick. If you prefer an even cleaner look (without any dot at all), try using a space " " in a column[ColorBox = " "] and apply background color conditional formatting ,that gives you simple color boxes, much like a native legend. I totally get that the Table layout may not be your ideal setup, but this is currently the closest way to fully control the legend style in Power BI. 
The output is looks like:

vpagayammsft_0-1744277367944.png

 

If my response helped you to reslove the query,consider acepting it as solution.

Regards,
Pallavi.

View solution in original post

10 REPLIES 10
AmiraBedh
Super User
Super User

You can manually create a legend using a standalone table visual or cards. Create a supporting table for your "Portfolio Type" values and corresponding colors. Then, display it as a small table or matrix visual styled to look like a legend. Place it below or next to your visuals.

If you have multiple visuals sharing the same categories you can reate a tooltip page showing the legend (using a bar or stacked chart) and then link each donut chart to that tooltip so users can hover to view the shared legend


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Thank you, Amira. I was hoping there might be some solution to have the color buttons/markers options exactly the same as in the original Legends, and just used that as a single legend for all? I don't think table would work well in my situations, and I did try to use Card (new) option, and using conditiona formatting for the fill might work ok, but the way it appears does not resemble the look of the Legend. So I am am not sure if there is any better solution available? However, I sure apprecite your suggestion to use cards. 

Anonymous
Not applicable

Hi @Mk60 ,
Thank you @AmiraBedh for the helpful response!

1.Add a Donut Chart from the Visualizations pane. Drag Portfolio Type to Legend field and drag Value to Values field.
2.Copy the donut chart twice and apply if any needed filters
3.Create a DAX Measure for Color Formatting using below:
    

LegendColor =
SWITCH(
    SELECTEDVALUE(LegendData[Portfolio Type]),
    "Equity", "#E67E22",  // Orange
    "Debt", "#3498DB",    // Blue
    "Real Estate", "#2ECC71", // Green
    "Black" // Default color if no match
)

4.Place the Matrix visual below all three donut charts.Turn off default legends in each donut chart to save space.
5.Remove gridlines, headers, and totals from the Matrix visual.
 Providing the file for your reference.

If the solution meets your requirement,consider accepting it as solution to find others more quickly.

Thank you.
Regards,
Pallavi.

Hi Pallavi,

Thank you so much for your time and willingness to provide step by step instructions. I trully apprecite it. (btw, I was able to semi-resolve this temporary by using New slicer, but then had to disconect it from the visuals, and do several other steps including conditional formatting for every individual Portfolio Type), but I wanted to try your approach as well.

So I did all of the steps you sugested, created small table for the colors, but I am apparently missing something obvious here, as I can't get the actual colors for the #colors I entered in my  "LegenData" table? Do I need to have some color pallete to use for this in order for the colors to show up? I see you did not use any conditional formatting in your sample? Any thought on what I am missing here? Thank you very much!

Mk60_0-1743796644083.png

 

Anonymous
Not applicable

Hi @Mk60 ,
Thank you for the followup! I would be happy to assist you.

The reason the colors didn’t show up is that Power BI doesn’t automatically apply color values from a column . To get those colors to appear, you may need to use conditional formatting and set it to pull the color from your ColorCode column in your LegendData table.
Here is how you can do :

  • In your table or matrix visual, click the dropdown next to the Portfolio Type field.
  • Go to Conditional formatting ,choose either Font color or Background color.
  • Then under “Format by”, select Field value, and choose your ColorCode column.

This will help you to give a closer visual match.

Hope this helps.If so, consider accepting it as solution.

Regards,
Pallavi.

Hi Pallavi,

Oh, so we do need conditional formatting, that was my question. Yes, in that case this should work. I also used conditional formatting using my trmporary approach using Card (new) as my visual. However, I do have additional fallowup here, if you don't mind and I am not sure if that's possible, when using your solution: Is there a way to somehow remove Values from the color codes, (i.e.#3498DB), so that we only have colors in the boxes?

Mk60_0-1744061376386.png

I could not find that as an option under visual formatting? Just curious. Regardless, I can sure accept your sugestion as a solution for my original question. Much appreciate your time and consideration.

Marin

Anonymous
Not applicable

Hi @Mk60 ,
Thanks again for the follow-up!
If you just want the color to show without the text, this make it work  like using a colored dot  with conditional formatting.

  • Create a new calculated column using below:
           LegendDot = UNICHAR(11044)
  • Plot a matrix visual and drag the LegendDot and Portfolio Type.
  • Click the dropdown on LegendDot in the visual’s Values pane.
  • Choose Conditional formatting , choose Font color.

  • In the formatting dialog ,set Format by Field Value and choose ColorCode column as the source then click OK.

Please refer the screenshot for detailed undesranding.

vpagayammsft_0-1744105783339.png

If this resolved your query,consider accepting it as solution.

Thank you for your cooperation.Have a great day!

Thank you so much for your time with this. I looked at your last suggestion, and it did work for sure, but we still have black dot in the color, which I would prefer to eliminate. The problem is that matrix visual apparently does not allow to apply conditional formatting to each individual cell, (unlike regular Table visual), but table visual is not my ideal solution that I was hoping to get to? Perhaps I am looking for impossible solution, not sure 🙂

When using Table visual, not matrix, and using your latest dot suggestion, and then cell conditional formatting for each individual dot to blend it within, that might be an option. However such legend will then become somewhat similar to a default legend? Like for the blue example here, dot is blended in with conditional format:

Mk60_0-1744121315256.png

Any other toughts? Thank you very much!

 

Anonymous
Not applicable

Hi @Mk60 ,
Thanks again for following up! you are right .The Matrix visual doesn’t support cell-level conditional formatting, which is why that black dot still shows up.
The Table visual does allow individual cell formatting, which is why the color blends work better, especially with the dot or space trick. If you prefer an even cleaner look (without any dot at all), try using a space " " in a column[ColorBox = " "] and apply background color conditional formatting ,that gives you simple color boxes, much like a native legend. I totally get that the Table layout may not be your ideal setup, but this is currently the closest way to fully control the legend style in Power BI. 
The output is looks like:

vpagayammsft_0-1744277367944.png

 

If my response helped you to reslove the query,consider acepting it as solution.

Regards,
Pallavi.

Thanks much for the space " " tip, I'll definitively test that. I assume it will give me the same final outcome with collored boxes as I got using Button slicer visual, but with your suggestion I can have metric names on the top of each color, making it look like actual legend. Thanks a lot again for your time and collaboration on this, Pallavi. Much apprecited!

Marin

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.