Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rasmusnielsen
Partner - Creator
Partner - Creator

Hide entry in legend if there are no data

Hi all,

I have a combo chart which displays data for a Date dimension for a couple products. I would like the legend to only show an entry for the products that the user has selected in the filter.

Screenshot 2019-02-18 at 15.43.48.png

In this screenshot, the user has selected product 0 and the legend should only contain an entry for product 0, but it still also shows product 1. (You can still see the datapoints for product 1 on the charts on the 0 linie, but only because I chose to show the data point marks = "Show data points" in presentation.)

My measure looks like:

 

// product 0
If(WildMatch(GetFieldSelections([product], ',', 10), '*0*') = 1 , Sum({$<product={'0'}>}volume) ,0 }

// product 1
If(WildMatch(GetFieldSelections([product], ',', 10), '*1*') = 1
, Sum({$<product={'1'}>}volume)
,0
}

I have tried with '', 0 and Null() in the else statement and I have unchecked the "Include zero values" in the Addons/Data Handling section of the chart.

Why is this not working?

 

Labels (3)
3 Replies
Channa
Specialist III
Specialist III

data is there you are not showing 

i don't think so u can hide

 

 

 

Channa
Channa
Specialist III
Specialist III

if you have single measure you can change legend by having expression in measure label based on condition

Channa
rasmusnielsen
Partner - Creator
Partner - Creator
Author

Thanks, but we need to have a measure for each product, so that our customer can select one or more products.