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
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior 

Group checkboxes in a Report

Hello folks,

I have to create a Report that show records grouped by checkboxes. For instance, I have an object that has 4 flags that can be checked independently. In the Report I have to show each checkbox in a row, showing how many records has each one flagged. The result has to looks like this:

Flag 1      2
Flag 2      2
Flag 3      2
Flag 4      4

Further more, I have show this in a bar chart. I have tried many approaches without success. The bucket field seems the best option, but it's not working properly (or I'm not coding it right). I have created a formula field to use it in the bucket field; it looks like this:

IF(FLG_1__c, "Flag 1" ,"") & " " &
IF(FLG_2__c, "Flag 2" ,"") & " " &
IF(FLG_3__c, "Flag 3" ,"") & " " &
IF(FLG_4__c, "Flag 4" ,"") & " " &

The problem is, when I run the report, it is not counting each flag separately and I'm getting the following result:


Flag 1               1
Flag 2               2
Flag 3               1
Flag 3 Flag 1     1
Flag 4               4

I'm using a matrix report. Does anyone has an idea?

Many thanks in advance!

Best Answer chosen by Zuinglio Lopes Ribeiro Júnior
PratikPratik (Salesforce Developers) 
Hi Zuinglio,

You will need to group by flag1, flag2, flag3 & flag4. Bucket field are not available on Checkbox field.

Solution:
Formula Field option:


Crete a formula field say"Flags" with formula return type as "Text"

Formula
IF( Flag1__c,"Flag1", IF( flag2__c,"Flag2", IF( flag3__c , "Flag3",IF(flag4__c,"Flag4","No Flag"))) )

Now group by your report by this field "Flags".

You can also create bucket field on "Flags" formula field to categorize.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.

All Answers

PratikPratik (Salesforce Developers) 
Hi Zuinglio,

You will need to group by flag1, flag2, flag3 & flag4. Bucket field are not available on Checkbox field.

Solution:
Formula Field option:


Crete a formula field say"Flags" with formula return type as "Text"

Formula
IF( Flag1__c,"Flag1", IF( flag2__c,"Flag2", IF( flag3__c , "Flag3",IF(flag4__c,"Flag4","No Flag"))) )

Now group by your report by this field "Flags".

You can also create bucket field on "Flags" formula field to categorize.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
This was selected as the best answer
PratikPratik (Salesforce Developers) 
Glad it helped! 

Thanks,
Pratik
Andy CapelAndy Capel
I was using this formula on a report that show which check boxes where checked. However, I've run into a problem where if they check more than one check box, only the first check box in the report is showing in the report. For example, If I have 3 check box options and all 3 are checked, then only the first check box item is showing up in the report. Is there a work around for this? Below one of the field formulas I'm using. So, if someone checks more than one box, the report only picks up the first on in the formula that is checked.
 
IF ( Imports_Capturing_Market_Share__c , "Imports Capturing Market Share", IF ( Losing_Market_Share__c , "Losing Market Share", IF ( Modernization__c , "Modernization" , IF ( New_Contracts__c , "New Contracts" , IF ( New_Facilities__c , "New Facilities" , IF ( New_Markets__c, "New Markets" , IF ( New_Product_Development__c , "New Product Development" ,IF ( Startup_Company__c , "Start Up Company" , IF ( Technological_Obsolescence_Product_Line__c , "Technological Obsolescence Product Line", "No Growth Issues or Opportunities")))))))))

 
Philipp MathisPhilipp Mathis

Hello Pratik can you pls help me. I'm having a similiar issue. Im having a multi-picklist field with 6 values;

  • VAR
  • ISV
  • Technology
  • Strategic Allianc
  • System Integrator
  • Consulting
I'd like to be able to group a report by those 6 picklist values(not by the combination of it but by each single value). I have already checked many options but nothing seems to be working. I'm also open to switch to checkboxes instead of multi-picklists but again there it seems to be the same issue that grouping is not possible. Also bucketing ->creating a bucket column was not possible as I couldn't access the checkbox or multi-picklist field.
Is there a way even with coding? Thanks for showing me how to achieve this.

Many thanks,
Philipp
Nikesha MasonNikesha Mason
I am atttempting to use the solution above that Pratik suggestion - however, I am receiving a syntax error:
 Error: Syntax error. Missing ')'


IF( General_Ed_CBTE__c,"General Ed: CBTE",
IF( General_Ed_contextual__c,"General Ed: contextual",
IF( General_Ed_field_education__c , "General Ed: field education",IF(General_Ed_hybrid__c,"General Ed:hybrid",
IF(General_Ed_mentoring__c,"General Ed: mentoring",
IF(General_Ed_non_English__c,"General Ed: non-English",
IF(General_Ed_online_education__c,"General Ed: online education",
IF(General_Ed_other__c,"General Ed: other",IF(General_Ed_practical_theology__c,"General Ed: practical theology",IF(General_Ed_programs__c,"General Ed: programs",
IF(General_Ed_resud__c,"General Ed: residential education", "No Flag"))) )


I can’t find the error message. Could you please help?