cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RaSa
Frequent Visitor

Ordered Gallery based on 2 tables

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.

1 ACCEPTED SOLUTION

Accepted Solutions

@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

View solution in original post

7 REPLIES 7
AhmedSalih
Super User
Super User

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
Frequent Visitor

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 🙂

@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
Frequent Visitor

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.

@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
Frequent Visitor

@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. 

@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

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,538)