
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Thank you in advance
Ian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might want to use this expression:
SUM( dollar) / SUM(TOTAL dollar)
Make sure you have division in your dimension.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you be able to share a sample to show what you have?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You probably want to put something like
sum(amount) /sum(total amount)
in an expression.
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure - What is the best way to share - some data is private

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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#)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should work for u .=sum(amount) /sum(total amount)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Thank you in advance
Ian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be like this:
Avg(Aggr(YourExpression, YourDimension))
