Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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

  Thank you in advance

  Ian

9 Replies
Not applicable
Author

You might want to use this expression:

SUM( dollar) / SUM(TOTAL dollar)

Make sure you have division in your dimension.

sunny_talwar

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

Vegar
MVP
MVP

You probably want to put something like

sum(amount) /sum(total amount)

in an expression.

Not applicable
Author

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

Not applicable
Author

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

sunny_talwar

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

Anonymous
Not applicable
Author

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

Not applicable
Author

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

sunny_talwar

May be like this:

Avg(Aggr(YourExpression, YourDimension))