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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sort or SortByCollumns...
Power Apps
Unanswered

Sort or SortByCollumns with choise data type from a sharepoint list

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I am trying to make a galery that shows only part of the data of a Sharepoint list.

Those data have to be ordered, first by a collumn named "Etat_suivi", and then a collumn named "Date_previsionnelle".

On Sharepoint, the data types are "choise" for the "Etat_suivi" collumn and "date" for the "Date_previsionnelle" collumn.

 

The Filter fonction works with both data types but when I tried to use SortByCollumns, it worked on the "date" type but not on the "choise" type. The same problem appeared with the Sort function. I noticed that the data type of my "Etat_suivi" column is "complex" in PowerApps. The choises in "Etat_suivi" are on a text form.

 

Here is one of the formula I tried :

 

Sort(SortByCollumns(Filter(T_suivi_com;(Etat_suivi="Date à définir") Or (Etat_suivi="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy")));"Etat_suivi";["Date à définir";"A publier";"Publié"]);Date_previsionnelle)

 

Do you have a solution for me ?

 

Thank you.

 

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    When you say this what do you mean by "it did not work"? 

    it worked on the "date" type but not on the "choise" type. The same problem appeared with the Sort function

     

    Please provide an explanation and a screenshot of what the gallery looks like both when working and not working.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Here is a try with a "date" data type.

     

    Capture_date.PNG

     

    And this is a try with a "choise" data type.

     

    Capture_liste.PNG

     

    I have two error message on Galery.Items :

    1-

    impossible to sort on this type of expression

     

    2- 

    function "Sort" contains invalid arguments
  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hi @Anonymous ,

    I will throw something in here to possibly assist my colleague @mdevaney .

    Firstly, I do not believe it is the Sort that is the problem - PowerApps is saying the expression you are trying to Sort is invalid (the Filter statement)
    While noting that Date filters are not delegable (whether they are turned into text or not), I was involved in another post today involving a filter requiring a date to equal another date. Could the item below  possibly be your issue here?DateSort.png

    There is more than one way to do this of course, but I know when I struck the problem a while ago, the code as per the post works.

    Also you might try using || instead of Or - and you don't need all the brackets if the arguments are all of the same type, though I am not sure this will make any difference.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Warren,

     

    First, thank you to work on my problem.I do not have problems with the date

     

    I do not have any problem to sort the date type. It is with the list type that I have a problem. I showed the sort function with a date type to show that it with another format.

     

    The filter function alone woks perfectly, I tested it. I think that it is the second argument (Etat_suivi) that is a problem.

    The list type data do not function like string data in PowerApps, to be able to use the filter function, I had to add “.Value” to the name of the column for my filter function.

     

    I noticed that the sort function worked with the “.Value” on Etat_suivi :

     


    Sort(Filter(T_suivi_com;(Etat_suivi.Value="Date à définir") Or (Etat_suivi.Value="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy"))); Etat_suivi.Value)

    However, I did not succeed to make it work the SortByCollumns function.

     

    I tried the followings formulas without success:

     


    SortByCollumns((Filter(T_suivi_com;(Etat_suivi.Value="Date à définir") Or (Etat_suivi.Value="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy"))); Etat_suivi.Value))

     


    SortByCollumns((Filter(T_suivi_com;(Etat_suivi.Value="Date à définir") Or (Etat_suivi.Value="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy"))); "Etat_suivi.Value"))

     


    SortByCollumns((Filter(T_suivi_com;(Etat_suivi.Value="Date à définir") Or (Etat_suivi.Value="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy"))); "Etat_suivi"))

     

    I need to use the SortByCollumns function because the order I want to use for my sorting is neither ascending nor descending.

     

    Do you have any solution?

     

    Thanks again for your reply.

  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hello @Anonymous ,

    I was just throwing some ideas to help @mdevaney ,

    I have tagged him above to continue with this.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    First, I noticed that you mispelled SortByColumns as SortByCollumns.  Please make a correction.

     

    SortByColumns((Filter(T_suivi_com;(Etat_suivi.Value="Date à définir") Or (Etat_suivi.Value="A publier") Or (Text(Date_reelle; "[$-fr]dd/mm/yyyy")= Text(Today(); "[$-fr]dd/mm/yyyy"))); Etat_suivi.Value))

     

    Secondly, you said "I need to use the SortByColumns function because the order I want to use for my sorting is neither ascending nor descending."  My question is what do you mean you want to by neither ascending or descending?  From what I understand that is what sorting means.  Please give an example.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."  

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @mdevaney 

     

    Thank you to offer me a solution. Unfortunately it didn't worked.

     

    For your second observation, I want to sort in that order ("Date à définir" => "A publier" => "Publié") which is neither a A to Z sorting nor a Z to A sorting.

     

    My client decided that the sorting was not a demand critical enough to spend so much time so I'll stop searching a solution from now.

     

    Howerver, I will be intrested in the solution if anyone finds it.

     

    Anyway, thank you @mdevaney and @WarrenBelz for your work on my problem.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard