Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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

Re: FirstSortedValue Reverse (-Aggr) not working

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

3 Replies
Not applicable

Re: FirstSortedValue Reverse (-Aggr) not working

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

MVP
MVP

Re: FirstSortedValue Reverse (-Aggr) not working

Seems to be working for the sample provided

Capture.PNG

Not applicable

Re: FirstSortedValue Reverse (-Aggr) not working

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