Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with FirstSortedValue()

Hi All

I am trying to get the count of incidents using the firstsortedvalue. I have filters for Category and the date. Below is the sample data.

Also, I can not have this at the script as the filters are dynamic.

      

IDGroup IDIncident GradeIncident TimeIncident IDIncident DateIncident Date ValueCategory
180364476A00:00:0095023049415239/6/2013Public
280364476A12:24:39957484684156410/17/2013Public
380364476A00:00:0098735114417334/4/2014Private
480364476A+00:00:161042660444196011/17/2014Public
580364476A+00:00:18107288827421184/24/2015Private
680364476A+00:00:311085080604232711/19/2015Private
780364487B00:00:0095023184416461/7/2014Public
880364487C12:24:3995748603416872/17/2014Public
980364487C00:00:0098735249418568/5/2014Private
1080364487B00:00:16104266179420833/20/2015Public
1180364487B00:00:18107288962422418/25/2015Private
1280364487C00:00:311085081954245012/1/2015Private

If I select Public and date '12/31/2014' I should see

    

80364476A+10426604411/17/2014Public
80364487C     957486032/17/2014Public

If I select just the date '12/31/2014' and nothing from the Category, then

    

80364476A+10426604411/17/2014Public
80364487C987352498/5/2014Private

Thanks for all the help.

18 Replies
sunny_talwar

How are you getting a count = 1? Can you elaborate?

Not applicable
Author

Desired result is

 

Incident GradeCount
A1
C1

I am trying this expression. But it is not giving me the right result.

Count( AGGR(

FirstSortedValue({<[Incident Date Value] = {"$(='<' & Date(Max({AS}[Incident Date Value])))"}, [Incident Date]>}[Incident ID], -[Incident Date])

,[Group ID]))

Thanks

sunny_talwar

Seems to be working for me:

Capture.PNG

Not applicable
Author

If I use the expression, i get a different Grade and ID.

Thanks

1.png

sunny_talwar

What did you remove? the dimension?

Not applicable
Author

I have attached the QVW.

sunny_talwar

See if the attached is helpful

Not applicable
Author

The grade should be C for 95748603. But it is showing B.

1.png

sunny_talwar

If you are going to be showing this in a straight table, I would suggest using [Group ID] as your dimension and hide it. and use three expressions:

Capture.PNG