Forum Discussion
Hiding blank Legend elemants
- 7 months ago
Hi MateuszW
Because the legends are measures, applying an “is not blank” visual filter (if one is used) can produce misleading results. For example, if the first measure evaluates to blank for a given data point, the remaining measures for that same point will also return blank, even if they should logically have values.
The practical workaround is to disable the built-in legend and instead use a visual that mimics the legend. Two common approaches:
- DAX-generated SVG legend. Create an SVG image in DAX that displays the legend color and label. This works visually, but since it is a single image, the legend items are not clickable.
- Circle SVG + button/tile slicer. Use a small DAX-generated circle SVG as the icon in a button or tile slicer and format it to look like a legend.
Note:
For both approaches, a disconnected table is required that lists the measure or metric names along with their corresponding colors. A measure should be created to return the appropriate value based on the metric name column.
In the second approach, the button slicer remains clickable, but it will not filter the line chart unless the measure described above is used within the visual.
Please see the attached sample pbix.
MateuszW Hey,
Yes—hide unused legend items by ensuring the series evaluate to BLANK and by disabling “show items with no data”.
Do these checks/fixes:
1) Turn off “Show items with no data”
- In the Build/Fields pane, click the ellipsis (…) on:
- Legend field → uncheck Show items with no data
- X-axis field (if available) → uncheck Show items with no data
Note : If you’re using a disconnected Categories table, it will list all categories; either relate it to the fact or keep it disconnected but ensure step 1 is applied and the chart measure returns BLANK for absent categories.
Thanks
Haish K
If I resolve your issue. Kindly give kudos to this post and accept it as a solution so other can refer this