# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

## Bar chart how to calculate a percentage

All;

I am in the process of creating a bar chart that shows a total dollar amount for each division and the colour shows the total number of transactions.   I would like to add the percentage of transactions for each division out of the total. Any ideas on how I can do this please?

I am drilling down to get to this point and so I am not clear on how to generate the total transaction count to be used as the denominator for the percentage calculation

Ian

9 Replies
Not applicable

## Re: Bar chart how to calculate a percentage

You might want to use this expression:

SUM( dollar) / SUM(TOTAL dollar)

Make sure you have division in your dimension.

MVP

## Re: Bar chart how to calculate a percentage

Would you be able to share a sample to show what you have?

Valued Contributor

## Re: Bar chart how to calculate a percentage

You probably want to put something like

sum(amount) /sum(total amount)

in an expression.

Please ekskuse my Norglish and Swenglish typos.
Not applicable

## Re: Bar chart how to calculate a percentage

Sure - What is the best way to share - some data is private

Not applicable

## Re: Bar chart how to calculate a percentage

Yes definitely, what I am not sure about is how to get the total.

what I have is  count(invoice#) to get a  count of the number of invoices per division

what I am not sure about is where I can get the total count for the denominator?  Should I do this in the load script and create a field called total_sales

If the count shows  Shoes = 15,  Coats =  20,  socks = 17  so

Shoes should be 15/52*100  = 28.8%

Coats                  20/52*100 = 38.4%

Socks                  17/52*100 = 32.6%

Thanks

Ian

MVP

## Re: Bar chart how to calculate a percentage

Count(TOTAL invoice#) as an expression should give you 52. So in order to get the percentage, you can use this

Count(invoice#)/Count(TOTAL invoice#)

Contributor II

## Re: Bar chart how to calculate a percentage

It should work for u .=sum(amount) /sum(total amount)

Not applicable

## Re: Bar chart how to calculate a percentage

Thank you to all that replied , I was able to get what I needed.

Does anyone also know how to get the  average of all and display on the title?

For example

We have a bar chart that shows time to close a ticket by ticket classification.

Class1 = 20 mins,  Class2 = 90 mins, and class3 = 240 mins

I would like to show on the title the avg close time  (20+90+240)/3 =116.6 mins