Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Combining two line charts into one

Hi,

I want to create one line chart with five lines (of five countries) showing the number of wins on the Y-axis and the last three years on the X-axis.

The first line should show the results of the country which I have selected.

The four other lines should show the results of the best four countries (countries with most wins) which are shown if I enter a set analysis, enter 4 as Max Visible Number and enter a correct sorting.

In example file the two different charts are shown, how can I combine those two in one?


Any help is much appreciated.

Chris

12 Replies
Not applicable
Author

Thanks John,

Your suggestion is exactly what I need.

Chris

On the subject of my expression and the nonexistant field:

I have stripped the code and the code below is also working and gives you the same result as in my previous (almost working) expression


sum({<Country={"=rank(sum({<Country=>}NumberOfWins), Country)<5"}>+. }NumberOfWins)


The dot can also be replace by f.e.: >

??

johnw
Champion III
Champion III

Maybe any broken set functions as the set of all selections? In other words, maybe a broken set functions like $? I can see how if you did the union of $ and the ranked countries, you'd get the behavior you're seeing. Yep, $ seems to do that, and it make sense with $. So I bet broken sets are functioning like $.

I suppose it makes sense in a way. It's not possible to select a value in a field that doesn't exist, so doing that means doing nothing, which means the set is $. Not sure why something as simple as a dot would still do that, rather than returning a syntax error. For that matter, I'm not sure why referencing nonexistent fields doesn't return a syntax error, and therefore null. But I guess it's not a big deal, just strange.

johnw
Champion III
Champion III

Hmmm, I thought I could simplify to this, but I guess it's confused and can't see that I'm doing dollar sign expansion instead of using the $ set. Thanks for using the same symbols to mean different things, QlikView. Helpful.

sum({<Country={"=rank(sum({<Country=>} NumberOfWins), Country)<5"}>$(=if(getselectedcount("Country"),'+$'))} NumberOfWins)

Might be something I did wrong, of course, but it would be nice if I could eliminate "QlikView is misinterpreting my symbol" as a possible cause.

Anway, at least we can simplify this much:

if(getselectedcount("Country")
,sum({<Country={"=rank(sum({<Country=>} NumberOfWins), Country)<5"}>+$} NumberOfWins)
,sum({<Country={"=rank(sum( NumberOfWins), Country)<5"}> } NumberOfWins))

There has to be something simpler, though, with all of that code the same between the two lines.