Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jguinyard
New 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
Valued Contributor

Re: How to calculate percentage in Qlik sense

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
Contributor II

Re: How to calculate percentage in Qlik sense

Percentage =      # of Objects /

                  (  # of Objects + # of Objects2 )

MVP
MVP

Re: How to calculate percentage in Qlik sense

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