Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table like the following
UserNamejavascript:; | Team | Count |
---|---|---|
User1 | Italy | 1 |
User2 | Spain | 1 |
User3 | Germany | 1 |
User4 | Italy | 1 |
User5 | Germany | 1 |
User6 | Italy | 1 |
I would like to have a Text Box that displays "Italy" as being the most popular choice...regardless of any selections that are made on the data.
I have seen some solutions for this but if I had a list box based on username and I selected e.g. User5, the value displayed in the text box would change to "Germany" and would not display "Italy" which is, regardless of the selection, still the most popular choice.
This seems such a simple thing to do but I cannot see a simple solution for it.
I was using the expression from your article
=only(if(aggr(Rank(Sum(WinCount)),Winner)=1,Winner))
If you have the expression that shows the right country without a selection but the wrong country with a selection, could you share it with us? I think I know the solution to your problem, being "use Set Analysis", but I need your expression to show you how to add it.
=Concat(Distinct {<Team={'Italy'},Count,UserName>}Team,',')
Hope this may help you.
Please find attached qvw.
Thanks
Kiran Kumar
Try this:
Expression:
=Concat(DISTINCT {<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team, ', ')
or
=Only({<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team)
I was using the expression from your article
=only(if(aggr(Rank(Sum(WinCount)),Winner)=1,Winner))
see this
I have created th Field COUNT considering that if it is not available in table
Table:
LOAD [UserNamejavascript:;] as UserName,
Team,
1 as COUNT,
Count
FROM
[https://community.qlik.com/thread/211911]
(html, codepage is 1252, embedded labels, table is @1);
Expression
=FirstSortedValue({1}Team,- aggr(Count(Team), COUNT))
What if Spain was actually the most popular, I'd want it to display "Spain" with having to change the formula
If I use this
=Concat(DISTINCT {<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team, ', ')
The text box with the formula is blank when I make a selection from the list box
If I use this
=Only({<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team)
I only get "Italy" displayed if I pick a user that has "Italy" as the choice. If I pick a user who has "Spain" the text box displays "-"
I'm not sure how this works yet, but it does.
It also works for me without adding the COUNT field.
Have you checked out the screenshot and the attached sample? In the screenshot, I have made a selection on UserName field (User 5) and we are still seeing Italy.