Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jguinyard
Contributor
Contributor

How to calculate percentage in Qlik sense

How do I calculate percentage in Qlik sense?

Ex.

Percentage =      # of Objects

                    # of Objects + # of Objects2

3 Replies
JustinDallas
Specialist III
Specialist III

Let's say we had a bunch of athletes that were either a Rugby player or a Baseball player, we could do something like the following.

COUNT({<[Object Type]={'BaseballPlayer'}>} ObjectId) /

COUNT({<[Object Type]={'BaseballPlayer'}>} ObjectId) + COUNT({<[Object Type]={'RugbyPlayer'}>} ObjectId)

yujiyamane
Creator II
Creator II

Percentage =      # of Objects /

                  (  # of Objects + # of Objects2 )

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you mean percentage contribution to the whole amount?

If so, you would have a dimension, such as Store, in a table and then have an expression like this:

sum(Sales) / sum(TOTAL Sales)

You would then need to use the Number format to tell Sense that this is a percentage.

If you want a Margin % it would be something like;

(sum(Sales) - sum(Cost)) / sum(Sales)

Hope that helps point you in the right direction?

Steve