I’m trying to count the number of items selected within a multi-select picklist and basically assign a ‘score’ based on how many items are selected within a particular list. I was able to work through a few of these using a case expression, but anything with over 3 choices there are just too many options for this to be feasible. Is there another/better way to count the items selected so I can then SUM a group of fields together?
Our use case is we’re using a multi select field to track specific feature blockers for our customers. We want to know how many blockers have been selected for each account so we can prioritize the impact and risk to those customers. Ideally we’d be able to pull that ‘score’ into a pie chart by CSM (to see how many accounts they have with the various number of blockers) or trigger a CTA with actionable steps to work through these blockers with the highest impacted accounts.
Thanks.
In your Bionic Rule
Step 1 - Create a Dataset.
- Fetch the records you’re interested in, At minimum, include some identifier (I’m a fan of the GSID and Name) and also the multi-select drop-down list for which you want to count values.
Step 2 - From the Step 1 Dataset, create a Transform with CASE statements to figure out which list items are selected.
- In your Transform, add your identifiers (in my example, GSID and Name)
- Add one CASE statement for each item on your multi-select drop-down list.
- Make your output a Number (probably with 0 decimal places).
- Make your CASE 1 to read if the drop-down includes the first field (and only the first field), THEN CUSTOM 1, DEFAULT CUSTOM 0.
- Repeat, creating a CASE statement for each item in your multi-select drop-down. (This is the tedious part, but happily you’re creating one field per list item, instead of trying to figure out all the possible combinations of list items.)

Step 3 - From the Step 2 Dataset, create a Transform with a Numeric Expression to count up the 1’s from your CASE statements.
- In your Transform, add your identifiers (in my example, GSID and Name) again.
- In this Transform, add a Numeric Expression. In your expression, add together all the CASE statement fields you created in Step 2. (In this screenshot, I’m showing just 2 line items, but imagine you have one item here for each drop-down list item.)
- This Numeric Expression now holds the number of values selected from the multi-select drop-down.

It’s not perfect, as you still need to do some lifting for each line item within your drop-down. However, it scales in a semi-reasonable fashion as you don’t have to figure out all possible combinations. If you ever add line items to your drop-down, you can revisit Step 2 to add a CASE statement for each new line item added and Step 3 to amend your Numeric Expression to include the new line items.
Looking for a productized solution here too.
Looking for a productized solution here too.
My only thought….and I’m not sure exactly how it would be executed...would be to somehow count the number of semi-colons in the field, then +1.
Looking for a productized solution here too.
My only thought….and I’m not sure exactly how it would be executed...would be to somehow count the number of semi-colons in the field, then +1.
I had thought the same thing! I can’t think of a way to do this within Gainsight HRE though.
Looking for a productized solution here too.
My only thought….and I’m not sure exactly how it would be executed...would be to somehow count the number of semi-colons in the field, then +1.
I had thought the same thing! I can’t think of a way to do this within Gainsight HRE though.
Here I was hoping I would inspire an idea and then you’d know exactly how to execute upon it.
It would be super tricky, but do you have SQL or Python tools that would let you strip those non-semi-colons out from a CSV? If you exported to S3, would you have fancy things that could process the data over there, and then also “transform” it back to an S3 file for ingest?
Looking for a productized solution here too.
My only thought….and I’m not sure exactly how it would be executed...would be to somehow count the number of semi-colons in the field, then +1.
I had thought the same thing! I can’t think of a way to do this within Gainsight HRE though
Here I was hoping I would inspire an idea and then you’d know exactly how to execute upon it.
It would be super tricky, but do you have SQL or Python tools that would let you strip those non-semi-colons out from a CSV? If you exported to S3, would you have fancy things that could process the data over there, and then also “transform” it back to an S3 file for ingest?
Yeah, I can totally accomplish this with tools outside of Gainsight. Just trying to decide how much effort it’s going to really take, and if the juice is worth the squeeze :-)
Hope you are doing well! Missed seeing you at Pulse this year.
Reply
Sign up
If you ever had a profile with us, there's no need to create another one.
Don't worry if your email address has since changed, or you can't remember your login, just let us know at community@gainsight.com and we'll help you get started from where you left.
Else, please continue with the registration below.
Welcome to the Gainsight Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.