3 Replies Latest reply: Mar 1, 2018 6:32 PM by Steve Dark

# How to calculate percentage in Qlik sense

How do I calculate percentage in Qlik sense?

Ex.

Percentage =      # of Objects

# of Objects + # of Objects2

• ###### 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)
```
• ###### Re: How to calculate percentage in Qlik sense

Percentage =      # of Objects /

(  # of Objects + # of Objects2 )

• ###### 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