3 Replies Latest reply on Apr 2, 2018 7:51 AM by Albert Dorfman

# Percentage Calculation in Graph

Hey everybody,

In this analysis I have everything filtered by a particular distribution channel (e.g. e-commerce sales), and I'm showing the number of units sold per year. I want to convert this into a percentage. So I want each bar to represent the following calculation: e-commerce sales/total sales for that particular year.

Does anybody know how I can do this?

Thanks! • ###### 1. Re: Percentage Calculation in Graph

Create an LOD calc for the total sales call it LOD Total Sales by Year:     {fixed [Year] : sum([Sales]) }

Then create another calc using the above calc:

Sum([Sales])/Sum([LOD total Sales by Year])

1 of 1 people found this helpful
• ###### 2. Re: Percentage Calculation in Graph

(EcommerceSales)/{FIXED Year:Sum(Sales)}

• ###### 3. Re: Percentage Calculation in Graph

Hey John,

Thanks for the answer, this is exactly what I was looking for.; however, I'm still having an issue.

I did what you said, but I'm getting the following graphs:

Evidently the number of records changes every year (bottom graph), but the percentage graph (top graph) stays the same, when it should be changing.

The top graph is made up of the following calculations:

Calculation 1: {fixed[Year]: SUM([Number of Records])}

Calculation 2: SUM([Number of Records]) / SUM([Calculation1])

I also have an e-commerce filter on here as you can see in the left. In plain english, here's what I want to happen for each year (example given for 2009)

E-commerce sales in 2009 / total sales in 2009 Any help would be greatly appreciated

Thanks!