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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Cross join or Cartesia...
Power Apps
Unanswered

Cross join or Cartesian Join of collections

(0) ShareShare
ReportReport
Posted on by 86

I have two lists.

 

A:

No  Name   Product

1     Tom        A1

1     Tom        A2

2     Jack        A1

3     Jerry       A1

3     Jerry       A3

 

B:

No   Sub-No  Rate  

1       1             A       

1       2             A-      

2       1             A+     

3       1             A-    

3       2             B+    

 

I would like to have

C: (joined from A and B by No)

No Name  Sub-No  Rate Product 

1      Tom      1           A       A1

1      Tom      2           A-     A1

1      Tom      1           A       A2

1      Tom      2           A-     A2

2      Jack      1           A+    A1

3      Jerry     1           A-     A1

3      Jerry     2           B+    A1

3      Jerry     1           A-     A3

3      Jerry     2           B+    A3

Categories:
I have the same question (0)
  • Geeks_D Profile Picture
    1,169 on at

    ForAll( A, Collect( C, AddColumns( Filter( B, ANo = BNo ), "Product", AProduct, "Name", AName ) ) );

    Geeks_D_3-1693842344698.png

     

     

    I did the collection with some distinct variable for the A and B 
    ClearCollect(A, {ANo: 1, AName: "Tom", AProduct: "A1"},{ANo: 1, AName: "Tom", AProduct: "A2"},{ANo: 2, AName: "Jack", AProduct: "A1"},{ANo: 3, AName: "Jerry", AProduct: "A1"},{ANo: 3, AName: "Jerry", AProduct: "A3"});
    ClearCollect(B, {BNo:1, SubNo:1, Rate: "A"},{BNo:1, SubNo:2, Rate: "A-"},{BNo:2, SubNo:1, Rate: "A+"},{BNo:3, SubNo:1, Rate: "A-"},{BNo:3, SubNo:2, Rate: "B+"});

    Geeks_D_1-1693842300106.pngGeeks_D_2-1693842319109.png

     

     

     

     

     

  • gcmfaizan Profile Picture
    1,022 on at

    @tonyjiang here is the actual working formulas:

    //Data A
    ClearCollect(
     A,
     {
     No: 1,
     Name: "Tom",
     Product: "A1"
     },
     {
     No: 1,
     Name: "Tom",
     Product: "A2"
     },
     {
     No: 2,
     Name: "Jack",
     Product: "A1"
     },
     {
     No: 3,
     Name: "Jerry",
     Product: "A1"
     },
     {
     No: 3,
     Name: "Jerry",
     Product: "A3"
     }
    );
    //Data B
    ClearCollect(
     B,
     {
     No: 1,
     SubNo: 1,
     Rate: "A"
     },
     {
     No: 1,
     SubNo: 2,
     Rate: "A-"
     },
     {
     No: 2,
     SubNo: 1,
     Rate: "A+"
     },
     {
     No: 3,
     SubNo: 1,
     Rate: "A-"
     },
     {
     No: 3,
     SubNo: 2,
     Rate: "B+"
     }
    )

    And here is the formula to merge both base on No. column:

    ClearCollect(
     C,
     AddColumns(
     AddColumns(
     A,
     "MergeKey", No
     ),
     "BData",
     Filter(B, No = MergeKey)
     )
    )

     

    gcmfaizan_0-1693850319050.png

     

    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

    Thanks!

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard