Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible to count the firstsortedvalues

Dear Mates,

I am new to qlikview,currently pursuing a developer course.

I had given an assignment to do a simple statistics on some past data.Everything went well but now I am stuck on.I need to get the count of group who have gained maximum points.I was able to show it in a straight box but cant show the same on a line chart.I need to know is it possible to count the firstsortedvalue.For your understanding I have given a sample.I have two tables,one having location,points and groupid and the other table having groupid and groups.

location,points,groupid

aa,100,A1

aa,150,B2

aa,300,C3

bb,200,A2

bb,300,B2

bb,100,C3

etc

groupid,group

A1,A

A2,A

B1,B

B2,B

C3,C

etc

So here winner groupid from location aa is C3 which belongs to group C ,which I got using firstSortedVlaue,likewise there are more than 100 locations so I need to count the number of times each group came like A=10,B=5,C=12 etc.

I created a straight table with location as dimension and used the expression firstsortedvalue(group,-points) to get group with maximum points .

So please help me to find out the solution.Thank you for your time.

1 Solution

Accepted Solutions
sunny_talwar

Try this as the dimension:

=Aggr(FirstSortedValue(group, -points), location)

Expression:

=Count(Aggr(FirstSortedValue(group, -points), location))

View solution in original post

6 Replies
sunny_talwar

Try this as the dimension:

=Aggr(FirstSortedValue(group, -points), location)

Expression:

=Count(Aggr(FirstSortedValue(group, -points), location))

Not applicable
Author

Thank you Sunny for your prompt and quick response.The solution is exactly what I needed.

oknotsen
Master III
Master III

If your question is answered, please flag the correct answer as Correct Answer. This will "close" the topic.

Please use "Helpful" for those (other) replies that helped you, but where not the or the best answer.

If made the correction for you in this case.

May you live in interesting times!
Not applicable
Author

Thank you for marking the same and I am sorry to say that I tried to mark it as right answer but couldnt see that option,this is my first time to this community.

oknotsen
Master III
Master III

All good .

Welcome to the Qlik Community!

May you live in interesting times!
Not applicable
Author

Hello,

In the example above if I add one more field 'year',how can I show which group Id wins each year in each location.I tried to plot a chart with location as dimension but couldnt get the desired result.The purpose of this chart is to predict the winning probability of groupid in respective location in coming years.I hope my query is clear.

Thank you for your time.