Run time calculations for linear or radial gauge

Hi,
I have a sales pipeline list with a calculated category column having these values (Cold, Warm, Hot, Won, Lost). I tried to build a linear or radial gauge to calculate the win rate (total won/total pipeline items)*100.

I tried following your example for doing run time calculations in sales distribution chart on the sales dashboard demo page: spchart.com/demo/sales-dashboard/config

However i couldn’t get it to work out for me on a linear or radial gauge.
Appreciate your help.

Hi,

I would propose:

  1. Create a calculated column that would output 1 for “Won” entities, otherwise 0
  2. Go to Data Source -> Aggregation
    a. enter anything that’s not an existing field name into Group by
    b. add an aggregated value: count = count of ID
    c. add an aggregated value: sumwon = sum of the calculated column from #1
  3. Go to Data Source -> Advanced, add the following line of code to the aggergationSuccess function:

handlers.aggregationSuccess = function(data, logger) { data.groups[0].winRate = data.groups[0].sumwon/data.groups[0].count * 100; return true; }
4. Click Process
5. Select winRate as the value for the chart.

Thanks a lot for your support, your solution worked out for me.

Hello Rostislav,

I have followed your example and everything seems to work, however my % should be ~20.5% and I am showing a tad bit above 40% for this particular view.

For this view:

Total Won (1) = 51 records
Total Items (0&1) = 248 records

Any advice would be greatly appreciated.
chart_export.zip (1.19 KB)

Hi,
Could you also provide a template of the source list with its content (list settings -> save this list as template -> tick Include Content).

Yes sir and thank you very much. Please see the attached.
Bid Log.zip (199 KB)

Hi! Replace your handlers.aggregationSuccess with this code and remove any extra-fields in DS -> Aggregation:

[code]handlers.aggregationSuccess = function(data, logger) {

var count = data.items.reduce(
function(count, curr){
return count + (curr.Status == “Won”);
}, 0);
data.groups[0].winRate = count/data.items.length;
return true;
}[/code]

After that choose in Dashboard -> Chart “winRate” in “Value”

Works beautifully. I want to thank you and your team for the excellent customer support.