Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
smic
Partner - Contributor II
Partner - Contributor II

Display all the results possible if equals

Hi,

I use a form allowing me to display the name of a person according to his results:
=FirstSortedValue(DISTINCT Name,-aggr(sum(test_ID), player_ID))

I only display in my KPI the "max" thanks to the firstshortedvalue formula.

However, I would like this time to display all the people in case of identical result ... How to do please ??

If there are several possible results, display them all by separating them with "commas" for example

 

Thanks you !

Regards

1 Solution

Accepted Solutions
Kushal_Chawda

// Replace below inline table with your actual data
Data:
Load * Inline [
Player_id,Player_Name, Test_id
1,toto,1
2,titi,1
1,toto,2
2,titi,2
3,tata,1 ];

Now you can use below expression in KPI object

=concat(aggr(if(max(total aggr(Count(distinct Test_id),Player_id))=max(total <Player_id>aggr(Count(distinct Test_id),Player_id)),
Player_Name&':'&count(distinct Test_id)),Player_id),',')

 

Annotation 2020-08-20 001022.png

View solution in original post

7 Replies
haskia
Partner - Contributor III
Partner - Contributor III

Hi Smic.

Have a look at the CONCAT()-formula. You can use the DISTINCT -parameter and even a custom sorting like yours above.

 

Usama
Creator
Creator

Hi Smic,
Can you please attach qvf or screenshot?

Thanks

 

From Nothing - To Something - To Everything
smic
Partner - Contributor II
Partner - Contributor II
Author

Hi,

thanks you to reply.
So, i have 2 table like this:

Player_IDPlayer_Name Test_IDPlayer_ID
1Toto 11
2Titi 12
3Tata 13
   21
   22

 

I want to know my players who are most present during the tests. I want to display the most present player during the tests. However, as in the current case, several players are tied ... I therefore wish that in my KPI indicator, there is the list of the first names of the most present players. Currently with the fistsortedvalue only one is displayed even if there is a tie ...

the formula with the sum is wrong. It is a count that it takes:

= FirstSortedValue (DISTINCT Name, -aggr (sum (test_ID), player_ID))

 

 

 

 

PS: I just saw that in the custom objects, there were multi KPIs. But now i want to filter the set analysis with a "count" function ...

 

=count({<player_ID =- {'0','-1'}, count(distinct test_id) = max(aggr(count({<Distinct test_id), player_ID))>} distinct test_id)

 

Regards

Kushal_Chawda

What is the expected output? Can you share some sample data?

smic
Partner - Contributor II
Partner - Contributor II
Author

hi,

I want this (because these two persons have been present during 2 tests sessions):

TotoTiti
22

 

In a Multi KPI chart.

In fact, i want to count distinct test_id by player_id.
But i want display only Player_id where count distinct test_id = max(aggr(count( Distinct test_id), Player_id))
How to filter the count  function and keep only max values of this count please ??

 

Regards

 

Kushal_Chawda

// Replace below inline table with your actual data
Data:
Load * Inline [
Player_id,Player_Name, Test_id
1,toto,1
2,titi,1
1,toto,2
2,titi,2
3,tata,1 ];

Now you can use below expression in KPI object

=concat(aggr(if(max(total aggr(Count(distinct Test_id),Player_id))=max(total <Player_id>aggr(Count(distinct Test_id),Player_id)),
Player_Name&':'&count(distinct Test_id)),Player_id),',')

 

Annotation 2020-08-20 001022.png

smic
Partner - Contributor II
Partner - Contributor II
Author

Hi Kush,

thanks you for helping !!