Forum Discussion

MateuszW's avatar
MateuszW
New Member
7 months ago
Solved

Hiding blank Legend elemants

Hello, I'm a new PowerBi user. I'm making a Stacked Area Chart supposed to show different categories of traffic at different locations. The problem is that some categories apply only to certain loca...
  • danextian's avatar
    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.