cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Best way to create a collection of distinct names from 3 different columns

What is the best way to create a distinct collection of people when the names can be in any one of 4 different columns in the source table?

 

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @JR-BejeweledOne :

I assume there is a table something like:

ClearCollect(
 TheCollection,
 {Name1:"Aof",Name2:"Bof"},
 {Name1:"Dof",Name3:"Bof"},
 {Name1:"Gof",Name3:"Dof"}
)

vbofengmsft_0-1631244835183.png

Then 

Distinct(
    Filter(
        Ungroup(
            ForAll(
                TheCollection,
                [Name1,Name2,Name3]
            ),
            "Value"
        ),
        !IsBlank(Value)
    ),
    Value
)

Result:

vbofengmsft_1-1631244896967.png

Best Regards,

Bof

 

View solution in original post

3 REPLIES 3
BCLS776
Super User
Super User

How about?:

  • Create four collections using Distinct() on the four columns
  • ClearCollect() those four collections into one
  • Use Distinct() one more time on the combined collection to weed out any duplicates

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

I trying to avoid that if possible.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Hi @JR-BejeweledOne :

I assume there is a table something like:

ClearCollect(
 TheCollection,
 {Name1:"Aof",Name2:"Bof"},
 {Name1:"Dof",Name3:"Bof"},
 {Name1:"Gof",Name3:"Dof"}
)

vbofengmsft_0-1631244835183.png

Then 

Distinct(
    Filter(
        Ungroup(
            ForAll(
                TheCollection,
                [Name1,Name2,Name3]
            ),
            "Value"
        ),
        !IsBlank(Value)
    ),
    Value
)

Result:

vbofengmsft_1-1631244896967.png

Best Regards,

Bof

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,987)