Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [group-by]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

SFMC - grouping records from Data Extension into 1 adding values into new fields

I am trying to group the records from Data Extension # 1 ('Self_Insurance_Expiry_Date_Entry_Step1') into Data Extension # 2 Data Extension # 1 has 2 records with same Contact__c and ...
Luiza Zdebska's user avatar
0 votes
0 answers
77 views

Grouped cumulative line chart won't stack

I've built a report showing cumulative sales over time for a 3 year period (YTD, last year and year before last). I'd like to have the report display a line chart of the cumulative sales with each ...
Carl Paulsen's user avatar
0 votes
1 answer
122 views

Field must be grouped or aggregated: Name?

I'm working on a query for an invoice template. We want for the "main" products to be displayed on the same list and the one time fees products to be displayed on an other list. We have ...
Audrey's user avatar
  • 1
0 votes
2 answers
282 views

Combining where and having clauses in group by

I am running a group by query. As part of this, I want to check the sum of one field, and then check if that sum exceeds a number. The number itself depends on the value of a second field, which is ...
hamayoun's user avatar
  • 2,777
-1 votes
1 answer
67 views

Visualforce Page: Group by Company and Consecutive Date Ranges

I have created a Visualforce Page .pdf to output Candidates and their previous Work Experiences. On the Work Experience records there is a lookup field for Company as well as fields for Title, Start ...
Jeff Callahan's user avatar
1 vote
1 answer
129 views

A field isGroupable is FALSE but GROUP BY is still working

I have enabled the Shield Platform Encryption and encrypted the BillingAddress field of the Account sobject. When checking the describe field result of the BillingCountry (sub-field of the ...
totaki's user avatar
  • 79
0 votes
2 answers
622 views

Group by 30min interval SOQL

I have below SOQL which runs fine to retrieve all hourly results for a given day (15-Aug in below example). I now need to break it down by 30minutes interval.Is that possible using a single SOQL ...
MBM's user avatar
  • 129
0 votes
1 answer
579 views

duplicate alias: name error while grouping

We are using bundle products in salesforce and I am trying to display the Order products in a PDF document which I am creating using VF page. In the Order detail page the Bundle products appear ...
Akshay Vasu's user avatar
0 votes
1 answer
357 views

SOQL check if unique value exists and throw error message

I want to check if all the records have the same values for "Group__c" field and throw a message if the values are different. Example data: If all the records are of the same group(Group-A ...
Jenina's user avatar
  • 25
1 vote
0 answers
62 views

Visualforce table for aggregate result grouped by CreatedBy.Name

I'm trying to create a custom report table in Visualforce based on an aggregate result retrieved by the SOQL: SELECT CreatedBy.Name, Description, SUM(Value1), SUM(Value2), SUM(Value3) FROM Object__c ...
Daniele's user avatar
  • 11
0 votes
1 answer
1k views

Group By in SOQL query using calendar week from Sunday to Saturday

I have a query that I'm working on where I need to group by in a calendar week that starts on Sunday and ends on Saturday. I was trying this: GROUP BY WEEK_IN_YEAR(Start_Time__c) This was close, but ...
Dman100's user avatar
  • 2,435
0 votes
1 answer
1k views

Using SAQL to place total at bottom of results instead of alphabetically ordered

I have a SAQL Query which takes a list and attempts to display a total row at the bottom. However, the way that my code is written is causing the Total column to be alphabetically rearranged so that ...
Scott B's user avatar
  • 27
0 votes
1 answer
353 views

marketing cloud - how to join my audience with subscribers having a distinct value [closed]

I have an audience in a table called wtab which contains a column mail, and I want to join it with the subscribers data view without duplicates. when I have one 1 column I can use the DISTINCT keyword ...
eeadev's user avatar
  • 340
1 vote
1 answer
1k views

How to include a row with subtotals by second level group in Einstein Analytics using SAQL?

I would like to add a subtotal row at the bottom of a compare table in an Einstein Analytics dashboard. The table is made up of sums of measures grouped by two dimensions. The subtotals needed are ...
DavidC's user avatar
  • 11
0 votes
1 answer
310 views

another GROUP and ORDER SOQL question

Honestly, I have never understood how the GROUP keyword works, I actually read many articles in the salesforce site; however, I still cannot really use this keyword properly, especially when it comes ...
Cuban coffee's user avatar
  • 1,564
-1 votes
1 answer
49 views

Apex TOP 20 Accounts grouped by text field

I would need support with my Apex Code. I want to get the TOP 20 Accounts ordered by a Number field "Total Quantity" grouped by a text field "Country". I need to get all the IDs of those accounts. ...
Antonino Cupi's user avatar
0 votes
0 answers
703 views

SOQL count number of grouped rows

Here's the gist of my query: Select count(Id) from OBJECT where (yada yada) GROUP By Field1, Field2 It's returning 43 rows of Count(Id). Instead, I need it to return 43. I've seen others answer ...
Don T.'s user avatar
  • 1
15 votes
1 answer
657 views

Is Salesforce SOQL GROUP BY case sensitive for different locales?

Lets say I have records with values like 'TEST DATA' and 'test data' in some field. When I run SOQL (in Developer Console or from Apex) by user with EN locale, it arranges records with 'TEST DATA' and ...
Oleksii Bezuhlyi's user avatar
0 votes
1 answer
672 views

Can you include only top 10 records in SOQL group?

I have the following Query [Select Supplier__c, Avg(Total_Sales__c) from Submittal group by Supplier__c order by Purchase_Date__c DESC] The issue is that I only want to include the latest 10 records ...
Hans Donkersloot's user avatar
1 vote
1 answer
3k views

SOQL: Aggregate, Grouping By and WHERE Clauses not working

This query SELECT Reason, COUNT(Id) FROM Case WHERE RecordType.DeveloperName = 'Problem' AND AccountId = 'xxxx' AND GROUP BY Reason is giving me Unknown parsing error: But when I run the ...
BoDiE2003's user avatar
  • 437
1 vote
2 answers
4k views

Marketing Cloud -SQL Group BY

I have a table and I need to run some calculations on it for reporting purposes. I want to add a row that measures counts by that month. And I'm attempting to use the following statement: SELECT ...
Waystone's user avatar
1 vote
2 answers
178 views

Access SOQL results by grouped field

I'm attempting to aggregate all ObjectPermissions at the user level for a user access review (audit) application. This application's central function is to show an end-user (a reviewer) their reviewee'...
Nicholas Zozaya's user avatar
10 votes
3 answers
7k views

What types of fields are groupable in a SOQL `GROUP BY` clause?

The Salesforce documentation is notably terse in describing Considerations When Using GROUP BY. The guidance provided for determining which fields can be grouped is simply: The Field object ...
David Reed's user avatar
  • 93.1k
3 votes
1 answer
814 views

error thrown while trying to do a group by

I'm trying to write a query that gives me the name of users and the total number of ids assigned to them. Here I've Daily_Task__c a custom object with a lot of fields, here I'm trying to get the ...
Rakesh K's user avatar
3 votes
1 answer
1k views

Do custom metadata types not support COUNT(fieldName) with a GROUP BY?

Question title covers most of it. Here's a sample query and the error I receive in response: SELECT COUNT(Id) FROM MyCustom__mdt GROUP BY MyField__c field Id does not support aggregate operator ...
Grekker's user avatar
  • 1,092
0 votes
1 answer
904 views

How do I create a chart with two lines, using grouping?

What I have: revenue data, summarized by calendar month. I have created a custom summary formula that totals the revenue for that month. Over all data, I have created a second grouping, based on a ...
Sander de Jong's user avatar
1 vote
0 answers
150 views

Group by, Complex query

I am trying to do a query that engloves two different querys, the idea is spend just one soql query instead two but I don´t find the way. AggregateResult[] results = [ SELECT ...
David Marciel's user avatar
2 votes
2 answers
10k views

Formula field cannot be grouped in SOQL GROUP BY query call

I have a Pipeline__c object with fields Segment__c, Status__c, and Sales_Date__c (among many other fields). I also have a Sub_Pipeline__c object which is related to Pipeline__c. Inside I have the ...
ohseekay's user avatar
  • 195
4 votes
1 answer
2k views

SOQL aggregate functions do not work with Task.ActivityDate

When I try the following in the Query Editor of the Developer Console: SELECT WhoID, COUNT(Id), MIN(ActivityDate), MAX(ActivityDate) FROM Task GROUP BY WhoID LIMIT 1000 I get the following error: ...
catalandres's user avatar
3 votes
2 answers
22k views

How to read field values from AggregateResult

I need to use group by cube to display the count of added services for each group for each package. I get an error on line 18: method does not exist or incorrect signature: void get(String) from the ...
Sebastian's user avatar
2 votes
1 answer
157 views

Group By Cube on Related List

I need to do a group by cube on a related list. What I want is to display a list of added services groups and the distinct count across all completed inspections by package, and the matrix should have ...
Sebastian's user avatar
1 vote
2 answers
1k views

CPQ - Template Section - Group Field - Sorting

I am in the process of using the Group Field in the Template Section object to Group a Line Items section, and am hitting an issue. It seems to be grouping in alphabetical order of the picklist ...
Dan Williams's user avatar
0 votes
1 answer
41 views

List has more than 1 row for assignment to SObject error

Help please, I test the SOQL query in developer Console, and work as expected But, i get error message in the VF My Controller is: public class InventoryReport { public List<...
Girbson BIJOU's user avatar
2 votes
1 answer
2k views

Use SOQL aggregation result to count number of related objects

I have a fun puzzle here, and would like to see if anyone has a better solution. There are 3 objects: Account, Infusion__c, Patient__c. Infusion__c is a child of Accounts, and Infusion__c has a ...
Jake's user avatar
  • 111
5 votes
1 answer
256 views

Group By Child Objects

I'm facing some trouble to GROUP BY a SELECT with 2 Child Objects. This is the following SELECT: [SELECT Id AtendId, BI_BR_Adabas__c, BI_BR_Adabas__r.BI_BR_Parceiro__c, BI_BR_Cliente__c, ...
Luis G. Lino's user avatar
1 vote
1 answer
894 views

SOQL record with highest value, GROUP BY not working

We have an object called "Compensation__c". This object contains the compensation a partner receives for selling a "Product2". "Compensation__c" has a start date. Before this date this compensation ...
Stijn's user avatar
  • 419
2 votes
1 answer
831 views

Group by part of string in SOQL

Is there any way to Group By part of string in SOQL. For example something like: Select Id, Name from Object__c group by Name.substringBetween('.','.') So query by part of a string field and not ...
Danish's user avatar
  • 165
0 votes
1 answer
747 views

SOQL Group By Query

I am trying to include an additional currency field in the below Group By query, but receive SOQL error. "Field must be grouped or aggregated". Is it possible to add a Currency Field to a Group By ...
SFDC-ThEq's user avatar
1 vote
0 answers
40 views

Salesforce google charts group by aggregate query not pulling appropriate results

Set<Id> realBy = new Set<Id>(); for (Projects__c vP1 : [SELECT Id,Name,(SELECT Id, Total_Value__c FROM Proj_Upd__r WHERE ...
JSwaroski's user avatar
1 vote
1 answer
258 views

Report Grouping by Date

I'm relatively new to SF but gaining steam quickly. I've got Opportunities that include a contract start date and contact end date and I am trying to create a report that summarizes who we have ...
MarkLumpus's user avatar
0 votes
1 answer
4k views

Group By in Soql

I need to group data on the basis of two fields "description" and "createdDate" in soql. Select Subject, WhatId, what.name, Owner.name, Owner.Id, IsVisibleInSelfService, ActivityDate, ...
Anzar's user avatar
  • 954
3 votes
1 answer
2k views

SOQL: Get most recent amount grouped by a parent and a type

Should be simple had it been SQL. But. I would like to get the amount field value that belongs to the most recent month available for that parent and that type. Data: Parent_Id__c Type__c ...
Lightning Evangelist's user avatar
-1 votes
1 answer
382 views

Too Many Records in salesforce

I have More amount of Records in salesforce, i have created field as not Unique.So for account Records is created with duplicate Records also,I want to check how many Records contain dulplicate ...
SFDC's user avatar
  • 668
0 votes
2 answers
47 views

Query error when use group by

can anyone explain it to me, why my query is error? here my query : PYEMPELEMENT__c[] VFLDLSTEmpSeparated = [SELECT Employee_No__c, Period__c FROM PYEMPELEMENT__c GROUP BY Employee_No__c, ...
Vikolai's user avatar
  • 67
2 votes
1 answer
8k views

How to get unique values of two fields in one SOQL?

I have a custom object named "Performance" in which there are two text fields named "Main Category" and "Sub Category". Here, I would like to first extract the unique values of Main Category from all ...
TSunar's user avatar
  • 197
1 vote
2 answers
4k views

Displaying month/year from createdDate in SOQL query

I am very new to Salesforce and struggling to get a query to return the data in the format I require - i.e pushing the results through Conga composer to feed a chart in a powerpoint template. The ...
DaveS's user avatar
  • 13
1 vote
1 answer
64 views

StandardSetConnector Aggregate query grouping

I have a pageblock table with the following columns: Company, Package, Type, Revenue, Age, Users, Total Usage Actions, Top 3 Modules. All of the fields apart from "Total usage actions" and "Top 3 ...
GJOkoro's user avatar
  • 11
4 votes
1 answer
10k views

how to use group by in soql with lists

Hi friends i'm new to sfdc development I wrote a sample query to fetch opportunities related to account with some conditions try to group i getting error. my code is: List<Opportunity_Trial__c>...
Pavan tej's user avatar
  • 1,460
0 votes
1 answer
746 views

Open rate by domain over time - SQL

I'm trying to figure out open rate over time based on domain however, it seems to error or timeout every time I run it. I've limited it to just gmail, yahoo, and AOL for now. SELECT o.domain , s....
Hanna's user avatar
  • 27
2 votes
2 answers
2k views

Salesforce group by

I want to use group by from salesforce query : SELECT Candidat__c, Commande__c,Statut__c,IsDeleted, TypeContrat__c FROM Candidature__c WHERE Candidat__c = '0032000001GAPoXAAX' AND Statut__c = '...
esydev's user avatar
  • 123