❄️✨Ho-ho-holiday offer for new projects! Check out our pricing page.

sum/count

Answered
Wailun Kwok asked 1 day ago

I have this data:

data: any[] = [
  {
    "projMgr": "Tom",
    "projNam": "111.2 Planning",
    "baseCost": 10000,
    "designCost": 1000,
  },
  {
    "projMgr": "Tom",
    "projNam": "111.2 Planning",
    "baseCost": 10000,
    "designCost": 2000,
  },
  {
    "projMgr": "Tom",
    "projNam": "111.3 Assembly",
    "baseCost": 20000,
    "designCost": 2000,
  },
  {
    "projMgr": "Mary",
    "projNam": "111.6 Test",
    "baseCost": 20000,
    "designCost": 100,
  }
];

And this configuration:

 
  p_rows = [
    {caption: 'Project Manager', uniqueName: 'projMgr'},
    {caption: 'Project Name', uniqueName: 'projNam'}
  ];
  p_measures = [
    {caption: 'Design Cost', uniqueName: '[designCost]', aggregation: 'sum', format: 'currency', active: true}
  ];

I tried doing average:

{
  caption: 'Base Cost',
  uniqueName: '[baseCost]',
  aggregation: 'average',
  format: 'currency',
  active: true
}

which works at the project level because it averages out. However, Tom's Total should be $30,000 instead of another average $13,333.

 

I almost need sum("baseCost")/count("baseCost") but that doesn't seem to work.

1 answer

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster 5 hours ago

Hello, Wailun!

Thank you for reaching out to us.

Kindly note that Flexmonster calculates both regular and total cells using the same aggregation. The request to define separate aggregations for totals is already included in our Customers' Wishlist, and we have recorded your interest in this feature.
Our team will notify you about any updates on the matter.

Feel free to reach out to us if any other questions arise.

Kind regards,
Solomiia

Please sign in or register to submit your answer