Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a legend via macro or expression?

Hi

I was wondering if it was possible to create a legend instead of using "Show Legend". Reason being, I have label in my legend that it appear as Null or "-" and I would like to get rid of that. I tried checking "Suppress When Value is Null" but it screws my bar chart. In order to create a legend, would I use expression or build a macro?

Just looking some guidance and direction

Thanks,

Cliff

11 Replies
Nicole-Smith

Okay, so here is what you need to do for it to work with the listbox.

Keeping the same dimensions/expressions I had in the last post:

Dimension: Drill Down

Expressions:

1.  Count ({<Survey = {'Bad'}>}[Number of Calls])

2.  Count ({<Survey = {'Good'}>}[Number of Calls])

3.  Count ({<Survey = {'Not Rated'}>}[Number of Calls])

Add a background color to each of the dimensions so that the colors stay consistent when something is chosen from the list box:

1.  Bad:  rgb(255, 83, 83)

2.  Good:  rgb(106, 154, 71)

3.  Not Rated:  rgb(75, 138, 243)

Then add a Conditional to each expression:

1.  Bad:  substringCount(GetFieldSelections(Survey, ',', 1000000000), 'Bad') <> 0

2.  Good:  substringCount(GetFieldSelections(Survey, ',', 1000000000), 'Good') <> 0

3.  Not Rated:  substringCount(GetFieldSelections(Survey, ',', 1000000000), 'Not Rated') <> 0

Capture.PNG

Not applicable
Author

ahhhh thanks soo much nicole, clearly I was way off with the if statements

Thanks so much for your help, much appreciated