Help

Help - Grouping using formula creates issues

Topic Labels: Formulas
Solved
Jump to Solution
2842 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Vatsal_Mehtalia
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey,

I am creating a base to understand staff allocation over the various projects - 1 person goes to 1 project only until they are transferred. I had to assign people (names) to specific projects (as in their current projects). I have created a sheet called transfers where there is a FROM project and TO project. Over time, each person will have a number of transfers. So in the staff sheet we see the various TO sites where the person has been transferred to over time. Now to find the most recent transfer and hence their current project I used the solution from this answer: Find last entry

So it does some work in the background and basically finds the most recent entry for the person and shows that in the formula as text

The problem is the grouping. As you see the name name has gone into 3 groups Cummins Pithampur Since they are showing text from the same source, they are required to be in the same group. The logic beats me. Some help please.

Thanks
Vatsal.

1 Solution

Accepted Solutions

Technically, a lookup field is most often returning an array, even when the related info is only coming from a single linked record. When grouping by a lookup field, my gut says that Airtable isn’t grouping by the literal text of the single item in that array, it’s somehow grouping by the array’s identity (or something…just taking a stab). There are two options I can think of to get around this: 1) Make a formula field that converts the lookup’s array into a string, and group by that field, or 2) change your lookup to a rollup that outputs a string. The latter will be cleaner because the formula will be contained in the field’s setup, and you don’t need an extra field.

When setting up the rollup field, use the aggregation formula: ARRAYJOIN(values). Assuming that you only have one linked record returning the current site, the groups should clean themselves up.

See Solution in Thread

6 Replies 6
Dalton
6 - Interface Innovator
6 - Interface Innovator

Hey Vatsal,

I think I’m 80% there in understanding what you’re trying to accomplish.

Would you mind sharing a screenshot of the records you are trying to group, and elaborate on how you want those records specifically grouped?

Thanks!

Hey Dalton, attaching screenshots…Screen Shot 08-01-20 at 08.12 PM Screen Shot 08-01-20 at 08.11 PM

So 1 image shows the ungrouped way and 2nd shows how it is grouped. The names are exactly the same since they are converted to text from an entry…

Thanks for your help!

Dalton
6 - Interface Innovator
6 - Interface Innovator

Vastal,

Can you double check that you don’t have an extra space at the very beginning or end of the original field where the Projects Worked field is looking up.

This may be causing the grouping to show differently due to even such a small difference.

Technically, a lookup field is most often returning an array, even when the related info is only coming from a single linked record. When grouping by a lookup field, my gut says that Airtable isn’t grouping by the literal text of the single item in that array, it’s somehow grouping by the array’s identity (or something…just taking a stab). There are two options I can think of to get around this: 1) Make a formula field that converts the lookup’s array into a string, and group by that field, or 2) change your lookup to a rollup that outputs a string. The latter will be cleaner because the formula will be contained in the field’s setup, and you don’t need an extra field.

When setting up the rollup field, use the aggregation formula: ARRAYJOIN(values). Assuming that you only have one linked record returning the current site, the groups should clean themselves up.

Thanks for the help - It got solved…

Hey Justin!

Your gut was right. In the rollup it showed 3 blanks along with the visible answer hence its grouping might have been different. (as in it searched and showed the current answer along with blanks)

So i created a new formula to concatenate this field and the new output worked perfectly.

Thanks a ton!

Vatsal