Rollup Array Unique?

I have a table that collects user reviews, and includes a multi-select field as one of the elements for their reviews

I want to aggregate the data from this table to generate average ratings etc.

I wan to generate an aggregated summary of the multi-select field content, so that the summary field will contain a single instance of each element in multi select fields belonging to the various reviews.

I’ve tried using a Rollup field with this formula : ARRAYUNIQUE(values) but I get repeated instances of values that appear in more than one of my original reviews.

What’s the right way to distill this down so I see only 1 instance of each multi-select option in my aggregated record?

Unfortunately, Airtable’s Rollup Array functions don’t work properly on multi-select fields (even though multi-select fields are supposed to be arrays). As far as I’m concerned, this is a bug in Airtable that you may want to report to support@airtable.com so they can work on fixing it.

In the meantime, you’ll need to take these steps:

  1. Change the rollup field that you created into a lookup field instead. Lookup the multi-select field.

  2. Create a formula field that points to your lookup field like this:
    ARRAYUNIQUE({Your Lookup Field})

I didn’t test it, but I think it’s not a bug in that case.
Rollup consider operation with array of values, but if any value is array, it receive array of arrays, or 2D-array.
It counts each different multi-choice as unique
For example, 5 users choose from 12 months multiselect
“January, February”
“January, March”
“March”
“February, March”
“February, March”

there are 4 unique answers here.

There are many ways to achieve desired summary, even dynamically supported summary table.
To remove array nesting, ARRAYFLATTEN formula used, but I don’t think it will help in that case. I think, of you create empty table, link reviews table to it and copy-paste whole multiselect field in link field (both in reviews table), it will create correct unique list with links and link count will be a number of choices for each item.

Filtering this table for some actions, which result passed to reviews table via lookup is equal to ‘having’ in SQL.
Also, pivot table app possibly doing the same or close to it.

Note that if your option contains comma(s), result will be counted as two (or more) different options in result table

Right, unfortunately you can’t even get it to work with ArrayFlatten, which is what would be expected to work, because the REST API documentation refers to multi-select fields as arrays. So the array functions should work, but sadly, they don’t. It’s very disappointing.

I have found inconsistent behavior with flattening a rollup of multi-select values. I logged the issue with support a while back and they confirmed that it was a bug. I think there was a workaround, but I would have to dig it up.

1 Like

Thanks for this info. I might need to email them today to nudge them about this issue. :stuck_out_tongue_winking_eye:

Found the workaround.

  1. Create a rollup field that rolls up the multi-select field. Set the formula to values. Save the rollup field.
  2. Convert the rollup field to a lookup field. Notice that the lookup will be formatted as plain text instead of the usual pill format.
  3. Create a new formula field that refers to the lookup field (that used to be a rollup) and use the formula ARRAYJOIN(ARRAYUNIQUE(ARRAYFLATTEN({lookup field})), ", ")
1 Like

Thanks. Pretty similar to my workaround above. Mine is probably more straightforward.

1 Like

Not just pretty similar, it is exactly the same. Notice that if you create a lookup directly (without it being a rollup first), it won’t work.

My formula has two additional optional functions that yours does not. I include ARRAYFLATTENin case the behavior changes it is needed in the future. I also threw in ARRAYJOIN because I like being 100% sure of the resulting data type and knowing for sure if the commas are really there.

1 Like

Holy cow, really?!? That is totally nuts!!! :scream:

(I’m on my phone now, so I can’t personally try this out at the moment.)

Great ideas! :grinning: :raised_hands:

I agree. It is nuts. But that has been my experience. If yoU can get it to work otherwise, please share!

I just tested this, and I was able to get it to work by creating a lookup field from scratch. So no need to convert a rollup field to a lookup field.

Although I did notice new odd behavior. If you convert a rollup field to a lookup field, it shows the values in black & white text. If you create a lookup field from scratch, it shows each value with its original multi-select color.

The bug isn’t that Rollup functions don’t work for multiselects, its that Rollup functions are available in formula fields. The Formula Field Reference specifically says that the array functions only work in Rollup fields.

Rollup functions should be reworked to be able to work for multiselects because that would be a good feature to have, but its not really an actual bug.

It says that “array functions can only be used in rollup fields or when the input field is a lookup.”

When using a multi-select field in a rollup field, that IS using a rollup field, which is exactly what they are telling us to do. So we’re doing what they’re telling us to do, but it doesn’t work.

I just reached out to Airtable Support on this issue, and they just confirmed with me that this is a known bug with rollup fields, and they do not have any information on when this will be fixed. However, they recommended that people use the workarounds that we listed in this thread.

That’s my bad, I misread this thread. I thought they were using an array function in a formula field pointed at a multiselect, which shouldn’t work be design.

1 Like

That was not my experience. I will test when I have access to a computer again.

This matches my experience. I was only able to get the unique multi-select options when using a formula field pointing to a lookup that is in back & white text, not pills.

Thank you very much @ScottWorld @kuovonne @Kamille_Parks - once again you have absolutely nailed the problem for me.

Can I just say that despite my many gripes with Airtable - currently including the insane lack of any reasonable scaling/upgrade path in their ‘product ladder’ - the amazing quality speed and generosity of you and many others in this community forum is one of the main reasons my team continues to use Airtable heavily. If only Airtable themselves were as attuned to their users as you all are to fellow forum members.

Your work here is very much appreciated :pray:

2 Likes

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.