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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Ordered Gallery based ...
Power Apps
Unanswered

Ordered Gallery based on 2 tables

(0) ShareShare
ReportReport
Posted on by 22

Hi,

Please check the screenshots to better understand my problem.

I have 2 dataverse tables:

1. to store information regarding stores

2. to store sales for each store

 

If I´m creating a gallery to display all the information related to the store I would like to have a store with the latest purchase date at the top. Do you have an idea how to solve that?

 

I´d be glad for every suggestion.

I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at
    Re: Ordered Gallery based on 2 tables

    Hello, @RaSa, You can use SortByColumns Function. In you Gallery Items proporty use: 

    SortByColumns(StoreTable, PurchaseDateColumn, Descending)

     

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

  • RaSa Profile Picture
    22 on at
    Re: Ordered Gallery based on 2 tables

    Hi @AhmedSalih, to use SortByColumns(StoreTable, PurchaseDateColumn, Descending) I would need to have PurchaseDateColumn inside the StoreTable which I do not have. Correct me if I´m wrong. Thanks for reply 🙂

  • AhmedSalih Profile Picture
    6,678 Moderator on at
    Re: Ordered Gallery based on 2 tables

    @RaSa, So I am assuming that you have the PurchaseDateColumn in the store sales table? Which is the Many -Side of the Relationship, correct? 

  • RaSa Profile Picture
    22 on at
    Re: Ordered Gallery based on 2 tables

    DataverseIdea.PNG

    @AhmedSalih that is how I manage data in dataverse. So the StoreTable contains only Store ID and Name. Using SortByColumns(StoreTable, PurchaseDateColumn, Descending)

     

    I am not able reference to PurchaseDateColumn since the StoreTable contains only ID and Name columns.

  • AhmedSalih Profile Picture
    6,678 Moderator on at
    Re: Ordered Gallery based on 2 tables

    @RaSa, you can do the following to create the View you have in your GalleryIdea.PNG:

     

    1. In the Gallery Items Property, add your StoreTabe Name
    2. You will insert the Labels to Show different values of the StoreTable and one Label to Show the Latest Purchase Date from the Store Sales Table.
    3. For the Label Text Property, use this Formula:
    4. First(SortByColumns(ThisItem.SalesTable, 'PurchseDateColumn',Descending)).PurchseDateColumn

     

    NOTE: I a, assuming that you already have a relationship in place. If not, check my tutorial here for how to accomplish this https://powerplatformplace.com/f/excel-to-dataverse-migration---part-1

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

     

     

     

     

  • RaSa Profile Picture
    22 on at
    Re: Ordered Gallery based on 2 tables

    @AhmedSalih That would works fine. But still the store with the latest purchase would not be listed at the top of the gallery, and that´s why I have decided to post the question here. 

  • Verified answer
    AhmedSalih Profile Picture
    6,678 Moderator on at
    Re: Ordered Gallery based on 2 tables

    @RaSa, okay, using Dataverse there is an easy way to do that. Create a View in the Sales Table and Add your Related Columns from the Store Table along with the PurchseDate Column in the Sales Table. Sort the View by PurchseDate Column and Save and Publish the View. 

     

    In the Canvas App, add a Gallery and select your Sales Table as Data Source, Then Select the View you Just Created. 

    AhmedSalih_0-1660578566356.png

     

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 308 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 222 Super User 2025 Season 2

Last 30 days Overall leaderboard