Forum Discussion

Mk60's avatar
Mk60
Resolver I
1 year ago
Solved

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!

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    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:

     

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

    Regards,
    Pallavi.

10 Replies

  • 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

    • Mk60's avatar
      Mk60
      Resolver I

      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's avatar
        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.