function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RevJoelRevJoel 

Total # Cases by Reason SOQL Query

I have a SOQL query defined to pull all case reasons for open cases for account X. Now I need to get the sum of open cases by reason. Here is my query thus far:

 

SELECT Reason FROM Case WHERE AccountId = '{pv0}' AND Status != 'Closed' AND Reason != 'null' Order By Reason

 

How do I get these totals from this query? Clues?

TheIntegratorTheIntegrator

try

 

SELECT Reason, Count(Id) FROM Case WHERE AccountId = '{pv0}' AND Status != 'Closed' AND Reason != 'null' Group By Reason Order By Reason

RevJoelRevJoel

Thanks for the reply. No go. Same exact results. I will keep plugging away...

 

One thing I neglected to mention is that this is for a Conga report. Not sure that makes a difference or not.