ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on September 24, 2018, 02:20:29 pm

Title: Grouping
Post by: queensgambit9 on September 24, 2018, 02:20:29 pm
When having rows with certain values with multidimension structure...would it be possible to group by those values?
How to handle aggregated data since fact only should be counted once?


Title: Re: Grouping
Post by: paramvir on September 24, 2018, 06:33:00 pm
it can be done by adding a formula column to extract primitive values and use this column for grouping.
Title: Re: Grouping
Post by: queensgambit9 on September 24, 2018, 08:49:24 pm
Hmm...got a short example? Not sure how to implement it.
The values are in the response from DB (multiple rows with different group but same fact)...
Title: Re: Grouping
Post by: paramvir on September 25, 2018, 10:43:44 am
There are already couple of examples on formula columns https://paramquery.com/pro/demos/grid_formula

and row grouping https://paramquery.com/pro/demos/group_rows

I can help you with more relevant example if share the structure of your rows with certain values with multidimension structure....
Title: Re: Grouping
Post by: queensgambit9 on October 04, 2018, 05:24:36 pm
Thanks.

Example:

type   category   id   value
-----------------------------
test   cat 1      1   10
test   cat 2      1   10
test   cat 2      2   30

Grouping on "type" with SUM will give "test SUM 50", correct in my case should be 40 since row with "id" 1 occurs multiple times...
Title: Re: Grouping
Post by: paramvir on October 04, 2018, 06:33:50 pm
Thanks for the example.

It can be solved in paramquery spreadsheet by use of this formula

=IF(COUNTIF($A$1:A1,A1)=1,B1,"")

https://superuser.com/questions/132700/excel-sum-that-excludes-duplicates

But Excel formulas can't be used in the place of row grouping aggregates and js formulas can't cross reference other rows, so I don't see any way to do it in case of row grouping.