# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Highlighted
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 .

Tags (2)
1 Solution

Accepted Solutions
MVP

## Re: Is it possible to count the firstsortedvalues

Try this as the dimension:

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

Expression:

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

6 Replies
MVP

## Re: Is it possible to count the firstsortedvalues

Try this as the dimension:

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

Expression:

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

Not applicable

## Re: Is it possible to count the firstsortedvalues

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

Honored Contributor III

## Re: Is it possible to count the firstsortedvalues

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

## Re: Is it possible to count the firstsortedvalues

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.

Honored Contributor III

## Re: Is it possible to count the firstsortedvalues

All good .

Welcome to the Qlik Community!

May you live in interesting times!
Not applicable

## Re: Is it possible to count the firstsortedvalues

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.