Author Topic: How can we calculate Custom row summary calculation conditionally?  (Read 1733 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Hello Team,

Requirement:
Exclude the records where Applicable column has No value from an avg(Custom row summary);

Can you please provide an example to calculate custom row summary for above requirement?

We have added an snippet in below URL;
Problem URL:
http://next.plnkr.co/edit/nCDCvzvt7eihojGl

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How can we calculate Custom row summary calculation conditionally?
« Reply #1 on: February 26, 2020, 11:52:29 am »
Please check this solution: https://stackblitz.com/edit/custom-aggregates

Code: [Select]
  var agg = pq.aggregate;
  agg.avgCustom = function(arr, col, rows) {   
    var vals = arr.filter(function(val, i){
      return (rows[i].applicable || "").toUpperCase() != "NO"
    })
    return agg.avg(vals, col)
  };
« Last Edit: February 26, 2020, 11:54:22 am by paramvir »