# Line chart to show a line as percentage of total of all lines per X rather than percentage of total of the line for all X

## Recommended Posts

It is difficult to articulate this question but I think this is likely something that many have tried to do. I want to create a line chart that shows percent of total. However rather than the percentage calculating against the lines total value over X I would like to calculate the percent against all lines per X. This sounds simple but I am struggling to find a way to accomplish this.See example for a better understanding.

Example: Say you have person A and person B and you are looking at qty sold by month. I want the line chart to show what percentage of the total monthly sales qty each person is responsible for. So the lines are person A and person B. The Xaxis is time (months). If person A sold a qty of 25 and person B sold a qty of 100in month-1 there would be two points, one at .2 (20%, person A) and one at .8 (80%, person B). In month 2 if person A sold a qty of 50units and person B sold a qty of 100 there would be two more points, one at .33 (33%, person A) and one at .67 (67%, person B). I attached a screenshot that shows this simple example of what I would like to do. I would prefer to accomplish this with a custom expression on top of the base data rather than building new tables/columns as helpersbut I am not sure if that is possible. I thought something like this might do it:

Sum([Qty]) THEN [Value] / Sum([Value]) OVER (All([Axis.Line]))

However all lines show 100%. So it seems axis.line is limited in scope of the current line resulting in the 100% (or possibly I am misunderstanding).I am not sure if there is a way to change scope to get at the total of all lines for the month.

Thanks in advance for looking at my question!

##### Share on other sites

• 2 months later...

Hi John3,

Not sure if you already solved the case, but I had a similar issue and found a working solution (although in a crosstab) by looking at this post: https://community.tibco.com/questions/add-percentage-calculated-column

Basically, by adding a grand total column and then applying the expression as mentioned in the post, I was able to show the percentages that are fixed. So they don't change when filtering or adding more values (in your case lines).

Hope this does work for you too.

Kind regards,

David