cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Line and stacked column chart: Hide series in legend when all blank values.

I have a Line and stacked column chart with 1 column series and 4 line series.

When one of the line series measures returns all blanks, there is no line visible - good, that is what I want.

But I also want the line series to not appear in the legend when there is no line visible.

How can I achieve this?

 

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

By my test, I'm afraid you can't do it directly. Here's the workaround.

1.Create a card visual, then create a measure like below, put the measure in it and turn off the category label.

 

Card = ""

 

vkalyjmsft_0-1655709375377.png

2.Create a color measure.

 

Color =
VAR _V =
    IF ( MAX ( 'Table'[Column5] ) = BLANK (), 1, 0 )
RETURN
    "RGBA(255, 255, 255, " & _V & ")"

 

3. Use the color measure in the card background color conditional formatting like this.

vkalyjmsft_1-1655709611212.png

 

vkalyjmsft_2-1655709628679.png

4.Put the card visual on top of the Column5.

vkalyjmsft_4-1655710323360.png

When there is blank of Column5, it display like this:

 

vkalyjmsft_3-1655710289630.png

When there're values in Column5, it will appear.

vkalyjmsft_5-1655710407427.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-yanjiang-msft thanks for the suggestion. I already know how to use this "rectangle color background to show/hide visuals" method. It would work in the case there is one legend entry to hide, but in my case I have two legend entries to hide. Hiding them would leave the remaining visible legend entries misaligned with a gap in between. 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors