# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Not applicable

## Points behind leader - rank set analysis

I have a simple requirement and have tried multiple calculations but cannot get the required result.

The following is the required result from an excel spreadsheet.

 Player Rank Points Behind John 1 941 0 Bill 2 919 -22 Dave 3 853 -88 Lisa 4 835 -106 Carla 5 832 -109 Joe 6 831 -110 Carl 7 826 -115 Kim 8 817 -124 Sheri 9 760 -181

The BEHIND column is what I cannot get a correct calculation for.  In pseudo code it would be

sum(rank = 1)Points minus sum(Points)

I need to show the number of points each player is behind the leader.

The main issue is that there can be multiple selections which give different players, ranks and points so I cannot hard code anything or pre-calculate anything as the selections change the data.  So the calculation must be in the straight table.

All help is appreciated.  Thanks

Tags (2)
1 Solution

Accepted Solutions
Highlighted
MVP

## Re: Points behind leader - rank set analysis

My bad, you might need this:

Sum(Points) - Sum(TOTAL {<Player = {"=Rank(Sum(Points)) < 2"}>} Points)

4 Replies
Highlighted
MVP

## Re: Points behind leader - rank set analysis

May be like this:

Sum(TOTAL {<Player = {"=Rank(Sum(Points)) < 2"}>}Points) - Sum(Points)

Highlighted
MVP

## Re: Points behind leader - rank set analysis

My bad, you might need this:

Sum(Points) - Sum(TOTAL {<Player = {"=Rank(Sum(Points)) < 2"}>} Points)

Highlighted
Not applicable

## Re: Points behind leader - rank set analysis

Awesome thanks so much.  I appreciate it.

Yes, the second one is what I need.

You answered many of the other posts that I read trying to figure this out as well.  Thanks for everything.

Highlighted
MVP

## Re: Points behind leader - rank set analysis

No problem, I am glad I was able to help