Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Add rows to line chart on selection

I have a dataset, which contains 'variable 1' broken out by month and by city.

I have created a line chart that plots two lines (where x = month and y = average of variable 1 values): (1) the average for all locations (doesn't change as additional filters are applied), and (2) the average for the selected cities. Within the filter, multiple cities can be selected, but the data for all of the cities is averaged together to create line (2).

What I would like to do instead is retain line (1), and allow up to three additional lines to be added to the chart as up to three cities are selected, with one line representing each city. Anyone know how to do this? I've poked around for info on conditional expressions, but I haven't found a clear answer yet.

1 Reply
sunny_talwar

I guess you can use 4 expressions and then make the other 3 conditional based on how many cities have been selected. So for example if 2 has been selected, 3 expressions will be active and 1 will be hidden. And to show specific cities, you should be able to use SubField(Concat(DISTINCT City, '|'), '|', 1) for first city and similarly 2, 3 for the rest of the two cities in your set analysis.

For City 1 set analysis: {<City = {"$(=SubField(Concat(DISTINCT City, '|'), '|', 1))"}>}

For City 2 set analysis: {<City = {"$(=SubField(Concat(DISTINCT City, '|'), '|', 2))"}>}

For City 3 set analysis: {<City = {"$(=SubField(Concat(DISTINCT City, '|'), '|', 3))"}>}

For more detailed help, I would suggest posting a sample