Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FirstSortedValue Reverse (-Aggr) not working

Hi,

I have a function as a measure in a text box:

FirstSortedValue(Distinct [Site Name], Aggr(Count([ID]),[Site Name]))


that works and returns the Site with the lowest count of the ID variable. However, If I try to reverse this using either of the following methods:


FirstSortedValue(Distinct [Site Name], -Aggr(Count([ID]),[Site Name]))

OR

FirstSortedValue(Distinct [Site Name], -1 * Aggr(Count([ID]),[Site Name]))


I get a NULL return (i.e. a small dash and no result). Is anyone else to determine why?


I attach a sample of the data in question.


Thanks

1 Solution

Accepted Solutions
Not applicable
Author

i try and work witch FirstSortedValue(Distinct [Site Name], -Aggr(Count([ID]),[Site Name]))

View solution in original post

3 Replies
Not applicable
Author

i try and work witch FirstSortedValue(Distinct [Site Name], -Aggr(Count([ID]),[Site Name]))

sunny_talwar

Seems to be working for the sample provided

Capture.PNG

Not applicable
Author

Hi all,

Thanks for your replies. It seems the problem was something in the data model. In my actual data I have something like this

  

IDSite CodeSite Name
11003Site C
21004Site D
31002Site B
41004Site D

where Site Name was loaded from a different table and linked up using Site Code as the key. Site Name has some NULLS from some incomplete data. Site Code is fully complete.

When I do a count using

FirstSortedValue(Distinct [Site Name], -Aggr(Count([ID]),[Site Code]))


it works.


Thanks to all