Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
mlarruda
Creator
Creator

How to show the percentage of the selected value over all values?

Dear Friends,

Suppose I have two columns (NAME and POINTS) like this:

NAMEPOINTS
John4
Jack3
Mary6
Louis2
Robert1
Sam7
John5
Louis3
Tom9

with each name potentially appearing more than once.

I have built a small box to display the sum of points (merely SUM(POINTS)) and, when I select John in the above example, the box shows 9 (since 4 + 5 = 9).

Now, I wish to build another box, to display the percentage which this points represents over all the set of names. In the above example, since the column POINTS sums 40, if no one is selected, I want the box shows 100% (= 40/40) and, if I select John, I want the box shows 22,5% (= 9/40). Is it possible?

Many thanks in advance.

Labels (3)
1 Solution

Accepted Solutions
gavinlaird
Contributor III
Contributor III

Use this expression:

sum(POINTS)/sum({<Name=>} POINTS)

The denominator uses set analysis, {<Name=>}, to ignore the user's selection in the Name field, returning the total points.

 

This expression will ignore ALL selections, rather than just the user's selection in the Name field:

sum(POINTS)/sum({1} POINTS)

 

More information on Set Analysis 

View solution in original post

2 Replies
gavinlaird
Contributor III
Contributor III

Use this expression:

sum(POINTS)/sum({<Name=>} POINTS)

The denominator uses set analysis, {<Name=>}, to ignore the user's selection in the Name field, returning the total points.

 

This expression will ignore ALL selections, rather than just the user's selection in the Name field:

sum(POINTS)/sum({1} POINTS)

 

More information on Set Analysis 

mlarruda
Creator
Creator
Author

Worked! Thank you very much!

 

Only one observation: you wrote "Name" (lowercase) and the formula didn't work. But when I changed to "NAME" (uppercase, like the real name of my variable), it worked.