Forum Discussion
Single Legend for multiple visuals?
- Anonymous1 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.
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:
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!
- Anonymous1 year agoNot 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.- Mk601 year agoResolver I
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?
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
- Anonymous1 year agoNot 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.
If this resolved your query,consider accepting it as solution.
Thank you for your cooperation.Have a great day! - Create a new calculated column using below: