cancel
Showing results for 
Search instead for 
Did you mean: 

Funnel Chart % of Total Calculation

DXC
8 - Cloud Apps
8 - Cloud Apps

Hi, can you help us with a script to calculate the % of total for each portion of a funnel chart instead of the % of the top category?

image (2).png

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @DXC ,

I hope this script works for you.

widget.on('processresult', function(se, args){	

	total = args.result.series[0].data.reduce((acc, el) => (acc = acc + el.y), 0)
	args.result.series[0].data.forEach(el => el.custom.percent = (el.y / total) * 100)
		
});

 

harikm007_0-1729043190393.png

 

 

-Hari

View solution in original post

2 REPLIES 2

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @DXC ,

I hope this script works for you.

widget.on('processresult', function(se, args){	

	total = args.result.series[0].data.reduce((acc, el) => (acc = acc + el.y), 0)
	args.result.series[0].data.forEach(el => el.custom.percent = (el.y / total) * 100)
		
});

 

harikm007_0-1729043190393.png

 

 

-Hari

DXC
8 - Cloud Apps
8 - Cloud Apps

Thank you!