Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Displaying the top value in a text box

I have a table like the following

UserNamejavascript:;TeamCount
User1Italy1
User2Spain1
User3Germany1
User4Italy1
User5Germany1
User6Italy1

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.

1 Solution

Accepted Solutions
Not applicable
Author

I was using the expression from your article

=only(if(aggr(Rank(Sum(WinCount)),Winner)=1,Winner))

View solution in original post

15 Replies
oknotsen
Master III
Master III

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.

May you live in interesting times!
kkkumar82
Specialist III
Specialist III

=Concat(Distinct {<Team={'Italy'},Count,UserName>}Team,',')

Hope this may help you.

Please find attached qvw.

Thanks

Kiran Kumar

sunny_talwar

Try this:

Expression:

=Concat(DISTINCT {<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team, ', ')

or

=Only({<Team = {"=Rank(Count({1}Team)) = 1"}, UserName>}Team)


Capture.PNG

Not applicable
Author

I was using the expression from your article

=only(if(aggr(Rank(Sum(WinCount)),Winner)=1,Winner))

Kushal_Chawda

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))

Not applicable
Author

What if Spain was actually the most popular, I'd want it to display "Spain" with having to change the formula

Not applicable
Author

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 "-"

Not applicable
Author

I'm not sure how this works yet, but it does.

It also works for me without adding the COUNT field.

sunny_talwar

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.