Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
JacobJones
Creator
Creator

Changing the text of a dimension label in a bar chart

I have a bunch of Locations that start with the parent name of the location. For instance, Tina's Tacos - New York, Tina's Tacos Chicago, and so forth. There are also locations like Bob's Burgers - London, Bob's Burgers - Paris. 

When I make a bar chart for these locations I want to be able to remove the parent name, so no Tina's Tacos and no Bob's Burgers. I've tried putting  =PurgeChar('Tina's Tacos, '') in the Label expression under the field expression in the Dimension menu, but it has no effect.

How can I remove any instance of these strings from my labels?

Thanks,

Jacob

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

If your examples are representative, this going to be quite complex as you have several cases to deal with. Those with a separating dash can be handled with a subfield to select the parent or the city. If there is no separator, then it is hard to separate them because the city names may contain one word, or more than one (New York); and so does the parent. Some cities may also contain a hyphen in the name as a further pitfall. Your best option in this case may be to go back to the source to get a proper separator (like a |, for example) inserted into the data.

Failing that, if the data set is not too complex, you may be able to use functions like SubstringCount() and MapSubstring() with specific problem town names  and/or parent names. If you provide a sample data set with more examples and the output you requires from each, then it will be possible to have a go at the coding that would be required.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
JacobJones
Creator
Creator
Author

So I can't just find and remove strings in the Label expression?

Something like: Replace(Name, 'Tina Tacos', ''). Is that not what the Label expression box is for?