# Sub Grouping of results

**URL:** <https://community.spicecrm.io/t/sub-grouping-of-results/125>\
**Category:** KReporter\
**Created:** [May 17, 2017, 8:19pm UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125 "2017-05-17T20:19:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam.brunette](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@adam.brunette](https://community.spicecrm.io/u/adam.brunette)\
**Post date:** [May 17, 2017, 8:19pm UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125/1 "2017-05-17T20:19:09Z")

</div>

Hello,

I am trying to condense a list of results from a custom module into some simplified counts.

I am looking to group the output by assigned user and then provide a count of 2 sub groups from a single field.

Conform Type has 2 values, “16AI” and “8RO”. I am looking to find a total count that each user has assigned of these 2 values.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/fe0388eaa2113f43faafe07ff28039d0265a8bd8.png)

Any suggestions would be very much appreciated.

-Adam

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [May 17, 2017, 10:41pm UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125/2 "2017-05-17T22:41:28Z")

</div>

Adam, do you mean something like this?  
 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/a4ebd98afa94e7cc0f9917f641fd95790b852baa.PNG)  
In my example I count the number of opportunities per opportunity type per user.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/25796d7cc5be106d0660eb26f7720de22e8a752d.PNG)

![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/d8be685aa038d5f92a5fc40f62eeacf5103cd2cb.PNG)

Alternative display would be with a pivot table.  
Following example presents the number of opportunities per user per sales stage

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/2a5ab4d625fd5ae2d9fd6432b5cf54ab6d9663aa.PNG)

---

<div class="post-metadata">

**Author:** ![adam.brunette](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@adam.brunette](https://community.spicecrm.io/u/adam.brunette)\
**Post date:** [May 18, 2017, 12:54am UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125/3 "2017-05-18T00:54:52Z")

</div>

Hello Martval,

This worked perfectly! Thank You for for quick response.

I refined it slightly by just not showing the user column and let them just show user by groups.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/0c94445754eb967020218f7d207555312101cd57.png)

Thanks Again!

-Adam

---

<div class="post-metadata">

**Author:** ![adam.brunette](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@adam.brunette](https://community.spicecrm.io/u/adam.brunette)\
**Post date:** [May 22, 2017, 1:55pm UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125/4 "2017-05-22T13:55:56Z")

</div>

Hello,

Would you happen to know a way to add columns and provide the totals on a weekly basis?

My boss has asked that I run this as a rolling weekly report and add the new weeks information onto the end of it. I dont mind entering all date ranges as there is only 26 weeks this report will be used.

I have marked up an excel export to show what Im looking for, and if anybody could point in the right direction I would appreciate it.

-Adam

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/1f070adf64580d9fbc5081595381e021e7c0b460.png)

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [May 22, 2017, 2:53pm UTC](https://community.spicecrm.io/t/sub-grouping-of-results/125/5 "2017-05-22T14:53:43Z")

</div>

Adam, that kind of view willnot be possible with the grouped view.  
You will have to change to pivot.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/d4576f5596dd718b750705434470de19942d5ef2.PNG)  
My pivot table display the number of opportunities created per user per business type per calendar week.

I dragged date entered to manipulate tab, added customFunction YEARWEEK({t}.{f} and grouped by it. I reordered grouping sequence. I renamed the column date created field to Week created

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/203e137cef1f62f1a2ad37bfbefcf62a51efae5d.PNG)

Pivot settings:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/7c8b06fe9ddfe0d92a1ea635900784cbd60b92a0.PNG)
