Author Topic: Pivot Help. How to create multiple aggregates from the same column  (Read 578 times)

wd_perf

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 26
    • View Profile
Can you please provide an example on how can I change the following pivot demo to be able to allow the use to display multiple aggregates for the same column? For example I want to be able to use the Pivot Mode to display max, min, avg at the same time for any column like Gold.

https://paramquery.com/pro/demos/pivot

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Pivot Help. How to create multiple aggregates from the same column
« Reply #1 on: March 29, 2022, 11:35:08 am »
Please follow these steps:

Define the columns in colModel.

Code: [Select]
            {title: "Gold", dataIndx: "gold", width: 100, dataType:'integer',
                tpCls: 'gold',denyGroup: true, denyPivot: true
            },
            {title: "Gold", dataIndx: "gold1", width: 100, dataType:'integer',
                tpCls: 'gold',denyGroup: true, denyPivot: true, editable: false
            },
            {title: "Gold", dataIndx: "gold2", width: 100, dataType:'integer',
                tpCls: 'gold',denyGroup: true, denyPivot: true, editable: false
            },           

Link new columns with the original column with help of formulas:

Code: [Select]
            formulas: [
                ['gold1', function(rd) {
                  return rd.gold;
                }],
                ['gold2', function(rd) {
                  return rd.gold;
                }]
            ],

wd_perf

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Pivot Help. How to create multiple aggregates from the same column
« Reply #2 on: March 29, 2022, 05:47:29 pm »
I see. Thanks for that example. Is it possible to do this without explicitly creating a new columns in the drag and drop selector? The use case I'm targeting would contain a few dozen columns. While this approach would work, it would explode the number of columns seen by the user.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Pivot Help. How to create multiple aggregates from the same column
« Reply #3 on: March 30, 2022, 01:53:38 pm »
columns can be hidden from toolPanel with tpHide property.