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 / Sort gallery by calcul...
Power Apps
Unanswered

Sort gallery by calculated Label text

(0) ShareShare
ReportReport
Posted on by

Hi,

I'm pretty new to Power Apps and having a problem I can't quite solve with the resources I found online, especially in this forum.

I've created a Gallery inside a Container, that Gallery works on an Entity as its data source (I hope I'm using the right vocabulary), the "Items" code is: "Filter(Entity; 'Entity (Views)'.'View'). I've translated this from German.

 

I've then added another Label to the Gallery that is used to calculate and display something using data from another entity:

Sum(Filter(Entity_2; Entity_2_Column1.Name = ThisItem.Name; DateDiff(Entity_2_Column2;Today();Days)<=7);Entity_2_Column3)

Entity_2_Column1 is a lookup column pointing to the Entity the Gallery uses as data source.

 

I would now like to sort the Gallery by the calculated values displayed in the Label's Text. How can I do that?

 

Thank you!

Categories:
I have the same question (0)
  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at

    Did you manage to resolve this issue?
    If not, share a little bit of how your data is structured so I can better elaborate on a way to do this.

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @dev12753 ,

     

    Sorting in a Gallery is actually sorting on the Items of this Gallery. In your case, you will need to add the values to an additional column. So, you need an AddColumns function to help achieve this:

    Sort(
     AddColumns(
     Filter(Entity; 'Entity (Views)'.'View'); 
     "SumDays";
     Sum(Filter(Entity_2; Entity_2_Column1.Name = ThisItem.Name; DateDiff(Entity_2_Column2;Today();Days)<=7);Entity_2_Column3)
     );
     SumDays;
     Ascending
    )

     

    However, you should be noted that this formula is not delegable so it will not work for a large data set. 

     

    Best regards,

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard