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 / SortByColumns only sor...
Power Apps
Answered

SortByColumns only sorting by days instead of months

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

So I have this code in a gallery and it filters everything correctly until I add records in different months. Instead of sorting by months and then by days inside each month, it filters ONLY by days and completely ignores the months, just like the attached image. What can I do to solve this?

 SortByColumns(
 Filter(Table1_2, 
 DateValue(Text(DATA, "[$-pt-PT]dd/mm/yyyy", "pt"), "fr") >= DateValue(Text(HOJE.SelectedDate, "[$-pt-PT]dd/mm/yyyy", "pt"), "fr") &&
 Estado = "A" &&
 //DateValue(Text(DATA, "[$-pt-PT]dd/mm/yyyy", "pt"), "fr") <= DateValue(Text(FUTURO.SelectedDate,"[$-pt-PT]dd/mm/yyyy", "pt"), "fr") &&
 If(!IsBlank(dpSearchDate.SelectedDate), DateValue(Text(DATA,"[$-pt-PT]dd/mm/yyyy", "pt"), "fr") >= DateValue(Text(dpSearchDate.SelectedDate, "[$-pt-PT]dd/mm/yyyy", "pt"), "fr"), true)
 ),
 "DATA",
 If(SortDescending1,Descending,Ascending)
 )
monthsbug.PNG
Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The problem you are experiencing is probably due to the fact your data source sees is a a text field.

    a string/text field is sorted in a different way than number/date field are.

    try to make a local collection of it, add a AddColumn to it in which you set your date field as a datevalue DateValue.

     

    then filter on the new column.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 
    Thank you for the answer, but how do I do that?

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Solved it by changing the SortByColumns to a Sort function and the "DATA" to DateValue(DATA).

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 294 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 169

Last 30 days Overall leaderboard