web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Distinct on Lookup of ...
Power Apps
Answered

Distinct on Lookup of many-to-many relationship

(0) ShareShare
ReportReport
Posted on by 518 Moderator

Good morning,

i have following data-model:

Customer (1-n) --> Projekt (1-n) --> Case (n:m) -->employee (Benutzer).

 

In a canvas app i need a gallery where only the customers are visible an employee is working for.

It is no problem to get the cases and therewith also the information about the projekts and customers:

 

LookUp(Benutzers,Fullname=User().FullName).'Cases (cr8ec_Projekt_Zugehoering_ref)'

 

But as this is on case level i will have multiple entries for the same customer.

As i can directly display the customer info in the gallery via (ThisItem.Projekt.Customer.name) it should be possible to filter the lookup somehow against the customers.

 

I think i will have to go to the projekts first via a next lookup.

But i am not complety sure on how to do this.

Any idea is welcome 

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @SLMR ,

     

    Could you please share more details about your scenario? Do you want to filter customers that current logged in user is working for? 

     

    If this is the case, please try below formula:

    Distinct(AddColumns(LookUp(Benutzers,Fullname=User().FullName).'Cases (cr8ec_Projekt_Zugehoering_ref)',"Customer1",ThisRecord.Projekt.Customer.name),Customer1)

     

    Best regards,

  • SLMR Profile Picture
    518 Moderator on at

    Thanks a lot for the quick answer.

    Works like charm for my application.

     

    Just another short question:

    Is it possible to alter the expression so that i can get the real customer entity.

     

     With your solution i can fill my gallery as i want. I can get all other information of the selected customer by using lookup, so it is fine.

    But getting the entity maybe interesting for the future.

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @SLMR ,

     

    What do you mean by get real Customer entity? After you have unique customer names, you can simply use below formula to get rows from Customer entity:

    ForAll(
     Distinct(AddColumns(LookUp(Benutzers,Fullname=User().FullName).'Cases (cr8ec_Projekt_Zugehoering_ref)',"Customer1",ThisRecord.Projekt.Customer.name),Customer1) As CC,
     LookUp(Customer, name = CC.Value)
    )

     

    Best regards,

  • SLMR Profile Picture
    518 Moderator on at

    Thanks again.

    That saves me a lot of time.

    Have a nice day

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard