Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to calculate percentage in Qlik sense

I would like to calculate a percentage in Qlik sense. The data is as:

myNumber:

2

3

5

I would like get a table as:

         myNumber   thePercentage

          2                   20%

          3                   30%

          5                    50%

Total  10                  100%

Any suggestion is appreciated!

1 Solution

Accepted Solutions
OmarBenSalem

sum(myNumber)/sum(total{1} myNumber) :

Capture.PNG

If you want the "totaux' to always be 10 no matter your selection :

Capture.PNG

change your sum(myNumber) to :

if(Dimensionality()=0,sum(total{1} myNumber), Sum(myNumber))

dimensionality()=0 is the 'total' dimension:

if we had a pivot table, and 3 dimensions: the first dimension is dimensionality()=1 and so on

Hope that helps

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Fixed it.

Just notice Qlik sense function is case sensitive sometimes.

OmarBenSalem

sum(myNumber)/sum(total{1} myNumber) :

Capture.PNG

If you want the "totaux' to always be 10 no matter your selection :

Capture.PNG

change your sum(myNumber) to :

if(Dimensionality()=0,sum(total{1} myNumber), Sum(myNumber))

dimensionality()=0 is the 'total' dimension:

if we had a pivot table, and 3 dimensions: the first dimension is dimensionality()=1 and so on

Hope that helps

Anonymous
Not applicable
Author

Hi Omar, thanks for your help! I used a similar expression and fix it.

rupamjyotidas
Specialist
Specialist

Please close the discussion

Anonymous
Not applicable
Author

OK. Thanks!