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 / ClearCollect give a un...
Power Apps
Answered

ClearCollect give a unexpected result

(0) ShareShare
ReportReport
Posted on by 12

Hi! I'm new in PowerApp and have a question that I hope you experts can help with. I have three tables where I make a ClearCollect on one of the tables while I collect/lookup data from the other two tables depending on the value in first table.

 

Collect stmt:

ClearCollect(MedlemIKlubber; AddColumns('[beolafs_Development].[t02MedlemKlubb]';

          "MedlemsNavn";LookUp('[beolafs_Development].[t01Medlem]';t01MedlemId = t01MedlemId).Navn;

          "KlubbNavn";LookUp('[beolafs_Development].[t03Klubb]';t03KlubbId = t03KlubbId).KlubbNavn)).

 

The ide here is to make a collection based on t02MedlemKlubb and add two new fields to the collections.

The content of the two new fields should be looked up from to different tables.

 

The t02MedlemKlubb table has the following fields and values:

ID    t01MedlemId   t03KlubbId

1              1                     5

2              1                     2

3              2                     5

 

The t01Medlem table has the following fields and values

t01MedlemId   Navn

           1             Bjorn-Even

           2             Hans Klausen

 

The t03Klubb table has the following fields and values

t03KlubbId        KlubbNavn

           2             VBTK

           5             ATK

 

The collection result is like this:

KlubbNavn  MedlemsNavn  t01MedlemId   t02MedlemKlubbId   t03KlubbId

VBTK           Bjørn-EVen            1                           1                          5

VBTK           Bjørn-EVen            1                           1                          2

VBTK           Bjørn-EVen            1                           2                          5

 

The collection result I wanted to have:

KlubbNavn  MedlemsNavn  t01MedlemId   t02MedlemKlubbId   t03KlubbId

ATK             Bjørn-EVen            1                           1                          5

VBTK           Bjørn-EVen           1                           1                          2

ATK             Hans Klausen        1                           2                          5

 

Can you see what is wrong her? Thanks!!

Categories:
  • Verified answer
    Meneghino Profile Picture
    6,949 on at

    Hello, yes this is an issue of disambiguation since the column names in the pairs of related tables are the same.

    Your LookUp conditions are ambiguous: t01MedlemId = t01MedlemId and t03KlubbId = t03KlubbId

     

    https://powerapps.microsoft.com/en-us/tutorials/operators/#disambiguation-operator

     

    You can try to use the disamiguation operator in the first instance and see if this works.  Sometimes you get a blue i warning about delegation to source, but mostly you can ignore it.

    If not, please let me know because there are other solutions.

  • Verified answer
    beolafsen Profile Picture
    12 on at

    Thanks!

     

    It work fine with the following syntax:

     


    ClearCollect(MedlemIKlubber;
            AddColumns('[beolafs_Development].[t02MedlemKlubb]';
                "MedlemsNavn";LookUp('[beolafs_Development].[t01Medlem]';t01MedlemId = '[beolafs_Development].[t02MedlemKlubb]'[@t01MedlemId]).Navn;
               "KlubbNavn";LookUp('[beolafs_Development].[t03Klubb]';t03KlubbId = '[beolafs_Development].[t02MedlemKlubb]'[@t03KlubbId]).KlubbNavn))

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard