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 / Collection that merges...
Power Apps
Answered

Collection that merges two SP list and display data horizontally to use in a gallery

(0) ShareShare
ReportReport
Posted on by

I have the following Sp Lists:

StudentClasses

 

TeachersGrades

nvpc_0-1697988847950.pngnvpc_1-1697989149906.png

 

nvpc_2-1697989261544.png

I need to create a collections to use in a gallery. This collections will display the Teachers grades horizontally.

Thanks in advance

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @nvpc,

     

    There is no built-in function to transpose rows into columns dynamically. However, as long as you know the amount of columns that need to be added - we can add them manually. 😊 To keep the code short, I have created an example for the first 2 teachers.

     

    ClearCollect(
     colMergedClassGrades,
     //Add columns to StudentClasses
     AddColumns(
     StudentClasses,
     "Teacher - 1",
     //Fetch the grade linked to the current ClassID & Teacher 1
     LookUp(
     TeachersGrades As Inner,
     ClassID = Inner.ClassID && Inner.TeacherID = 1,
     Inner.Grade
     ),
     "Teacher - 2",
     //Fetch the grade linked to the current ClassID & Teacher 2
     LookUp(
     TeachersGrades As Inner,
     ClassID = Inner.ClassID && Inner.TeacherID = 2,
     Inner.Grade
     )
     )
    )

    Using ClearCollect is not necessary, you can use the AddColumns code directly in the Items property of the gallery.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • nvpc Profile Picture
    on at

    Thank you, this works! I was over thinking and was trying to create a "pivot table".

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard