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 addcolumn...
Power Apps
Suggested Answer

clearcollect addcolumns from related table

(2) ShareShare
ReportReport
Posted on by 353
I have a two tables related many * many - 'ELT_Metrics' and the system table 'Users'

I'm trying to clearcollect and include the first related users email. But it wont work. Any ideas? 
ClearCollect(
    colMetricSummary,
    ShowColumns(
        AddColumns(
            ELT_Metrics,
            
            'RelatedUserEmails', 

           First(Users).'Primary Email' 
        ),
        'Metric Name',
        'Domain',
        'InputCount',
        'CompletedInputCount',
        'RelatedUserEmails' 
    )
);


Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at
    When dealing with a many-to-many relationship the output is expected to be a Table, so try this
    ClearCollect(
       colMetricSummary,
       ShowColumns(
          AddColumns(
             ELT_Metrics,
             'RelatedUserEmails', 
             Concat(
                ThisRecord.Users, 
                'Primary Email', 
                "; "
             )
          ),
          'Metric Name',
          'Domain',
          'InputCount',
          'CompletedInputCount',
          'RelatedUserEmails' 
       )
    );
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • nick9one1 Profile Picture
    353 on at
    Thanks for the reply Warren. 
     
    Unfortunately I get this error;
     
     
    if it helps, this is my relationship in dataverse;

  • Suggested answer
    VASANTH KUMAR BALMADI Profile Picture
    352 on at
     
    ClearCollect(
        colMetricSummary,
        ShowColumns(
            AddColumns(
                ELT_Metrics,
                "RelatedUserEmails",
                First('Users (ELT_Metrics_Users)').'Primary Email'
            ),
            'Metric Name',
            'Domain',
            'InputCount',
            'CompletedInputCount',
            'RelatedUserEmails'
        )
    );
  • Suggested answer
    Valantis Profile Picture
    4,819 on at
     
    Both Warren and VASANTH are on the right track but the key is finding the exact navigation property name for your many-to-many relationship.
     
    In Dataverse many-to-many relationships, you navigate via the relationship name, not the table name directly. The relationship name in your formula needs to match what Dataverse exposes as the navigation property.
     
    To find the correct name:

    1. Open make.powerapps.com > Tables > ELT_Metrics > Relationships
    2. Find the relationship to Users and note the Relationship name (it will look something like ELT_Metrics_Users or similar)
    3. Use that exact name inside ThisRecord in the formula
     
    So Warren's approach is correct in structure:

    Concat(ThisRecord.'Your Relationship Name', 'Primary Email', "; ")
    And VASANTH's suggestion of First('Users (ELT_Metrics_Users)') is also trying to reference the same thing.
     
    Can you share the exact error message you got with Warren's formula and the relationship name shown in your Dataverse table settings? That will tell us exactly which navigation property name to use.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • nick9one1 Profile Picture
    353 on at

  • nick9one1 Profile Picture
    353 on at
    Thanks @Valantis I think that gets me a lot closer

    in the relationship I see two names 

    ELT_Metrics_SystemUser_SystemUser and elt_metrics_systemuser




    I have swapped out the concat line, with what you suggested, and replaces the table name with both of the relationship names, but neither works? 
    I have tried;

    ELT_Metrics_SystemUser_SystemUser
    elt_metrics_systemuser
    cr20b_ELT_Metrics_SystemUser_SystemUser
    ​​​​​​​cr20b_elt_metrics_systemuser


  • Suggested answer
    Valantis Profile Picture
    4,819 on at
     
    The reason none of the relationship name variants work is that the systemuser table is a restricted system table and canvas apps can't traverse the N:N navigation property to it directly the way they can with custom tables. This is a known limitation.
    The workaround is to query the intersection table directly instead. Your intersection table is cr20b_elt_metrics_systemuser. Use that to get the related user IDs, then look up their emails.
    Replace the AddColumns line with this:
    ClearCollect(
        colMetricSummary,
        ShowColumns(
            AddColumns(
                ELT_Metrics,
                'RelatedUserEmails',
                Concat(
                    Filter(
                        cr20b_elt_metrics_systemuser,
                        elt_metricsid = ThisRecord.elt_metricsid
                    ),
                    LookUp(Users, systemuserid = systemuserid).'Primary Email',
                    "; "
                )
            ),
            'Metric Name',
            'Domain',
            'InputCount',
            'RelatedUserEmails'
        )
    )
    The column names inside the Filter and LookUp will depend on the exact logical names in your intersection table. Open cr20b_elt_metrics_systemuser in Power Apps > Tables > Columns and check the exact names for the metrics ID and user ID columns.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 627

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard