I'd like to group a view on two columns at the same time. The first column contains a serial number. The second column, Related To, is a lookup pointing to the Serial Number column. What I'm looking for is a way to group the view so that any items with EITHER a serial number or a matching value in the Related To column are grouped together within the view.


Item     Direction     SN     Related To
Hiya     Incoming      123    
This     Incoming      234
Is       Outgoing      345    123
An       Outgoing      456    234
Example  Outgoing      567    123

The result of this would be something like the following:

+ 123
+ 234

For now I'm working under the assumption that Incoming items have a serial number only, while Outgoing will have both SN and Related To filled in. I'm assuming SPD is needed to get something like this to happen. Do you have ideas on how to make this happen?

  • In your example, the direction of the non-related items is incoming, and the related items is outgoing. Is this always going to be the case? – Hutch Jul 7 '14 at 16:40
  • That's my understanding right now, yes. I have a feeling if I can get this working, a future change might be manageable; I'm just not sure how to get started doing this. – AurumPotabile Jul 7 '14 at 18:28

You are trying to condionally group by columns, that is not possible Out of the box.

Edit: For lookup columns:

I would advise you build this using JavaScript. However, if that's not an option for you, I would create a single field column (not a calculated column) and create a SPDesigner workflow that runs on edit and uses the same logic.

If you're not using lookup columns you can use the below:

  1. Create a new calculated column called SnCalculated (choose whatever name you want)
  2. The formula should be something like this IF([Direction] <> 'Incoming', [Related To], [SN]). This says "If direction does not equal Incoming use Related To, otherwise use Sn"
  3. Group by the calculated column
| improve this answer | |
  • 1
    This was what I had in mind as well, but unfortunately lookup columns aren't available in Calculated columns – Hutch Jul 7 '14 at 19:14
  • @Hutch updated answer, you can use JS or SpDesigner WF – mhijazi Jul 7 '14 at 19:38
  • yup SPD workflow works. You would want to trigger it on add as well as edit I think. – Hutch Jul 7 '14 at 19:49
  • actually edit would suffice as I think it runs in both cases – mhijazi Jul 8 '14 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.