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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display multiple lines on Line Graph upon multiple selection

Hi Masters,

I have a Line Graph that has 7 expressions each representing the sales of one of the 7 zones (Zones is the field name, field values are '1', '2', '3'. etc), with the dimension as YEAR. Normally speaking, the graph will display 7 lines showing the sales of the 7 zones as expected. However, on top of that, I would to make it such that when the user selects some of the zones (ex. '1' and '3'), it will change from showing all 7 zones to show only zone 1 and zone 3. I tried the following expression, but it only works sometimes (ex. when user select zone 1 only, or zone 2 to 6 the same time, but doesn't work when selection is only zone 2 or zone 3 or zone 4, etc). Is this a bug with the personal free version? Can someone recommand a better expression? Your help is truly appreciated!

IF(SubStringCount(GetFieldSelections(ZONES), '2') >= 1 OR GetSelectedCount(ZONES)=0, Sum ({$<[HIGHER REPORT LEVEL]=[HIGHER REPORT LEVEL] +{HCA}, ZONES = {'2 - Pennisula'} >}TONNES), NULL())

Regards,

Will



1 Solution

Accepted Solutions
celindho
Partner - Creator
Partner - Creator

Hi Will,

Why have you created 7 different expressions if they draw exactly the same (except for different regions), do you have some special calculation rules that are different in the expressions?

I'd solve this by having two dimensions in the chart, the first one being year and the second being region. This way you can have one common expression, say sum(TONNES) as the only expression (maybe you need to use sum({$<[HIGHER REPORT LEVEL]=[HIGHER REPORT LEVEL] +{HCA}>} TONNES) as your expression?). By doing this, you don't have to define which expressions are drawn and wich are not.

Does this solve your problem?

I came to think of another solution to your problem if you truly need different expressions for each region: sum({<REGION=REGION*{"2 - Pennisula"}>} TONNES) would give a result different from zero only if "2 - Pennisula" is in the current selection (selected or related to selection, i.e green or white in a listbox).

Hope this helps!

-Christian

View solution in original post

2 Replies
celindho
Partner - Creator
Partner - Creator

Hi Will,

Why have you created 7 different expressions if they draw exactly the same (except for different regions), do you have some special calculation rules that are different in the expressions?

I'd solve this by having two dimensions in the chart, the first one being year and the second being region. This way you can have one common expression, say sum(TONNES) as the only expression (maybe you need to use sum({$<[HIGHER REPORT LEVEL]=[HIGHER REPORT LEVEL] +{HCA}>} TONNES) as your expression?). By doing this, you don't have to define which expressions are drawn and wich are not.

Does this solve your problem?

I came to think of another solution to your problem if you truly need different expressions for each region: sum({<REGION=REGION*{"2 - Pennisula"}>} TONNES) would give a result different from zero only if "2 - Pennisula" is in the current selection (selected or related to selection, i.e green or white in a listbox).

Hope this helps!

-Christian

Not applicable
Author

Haha, both methods work just fine! I felt quiet stupid not realizing that, thank you so much for your help!