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 / Correct way to sort mu...
Power Apps
Answered

Correct way to sort multiple column with different order

(1) ShareShare
ReportReport
Posted on by 2

I am using the below code to sort the date column first and then the number column next but with different ascending,

It does not bring the correct result but not showing any error, below is full code I am using in the default value of the gallery.

 

Kindly advise, my sort order code is correctly written or should be modified 

(it is possible to write multi column sort in one line by comma with different order, as my code has to arrange the data sorting twice)

 

LookUp(
SortByColumns(    
SortByColumns(
colAllWarranty,
"cr333_claimdate",
SortOrder.Descending
),
"cr333_claimno",
SortOrder.Ascending),

(Len(TypeModel_1.Value) = 0 || TypeModel_1.Value in MachineModel) &&
(Len(TypeSerial_1.Value) = 0 || TypeSerial_1.Value in MachineSerial) &&
(Len(TypeClaimNo.Value) = 0 || TypeClaimNo.Value in ClaimNo) &&
(Len(TypeJobDesc_1.Value) = 0 || TypeJobDesc_1.Value in FailureDetails || TypeJobDesc_1.Value in OtherDetails) &&

(
(DateValue(ClaimDate) >= If(IsBlank(DeliverFromDate_2.Value), DatePicker3_2.Value, DeliverFromDate_2.Value))  &&
(DateValue(ClaimDate) <= If(IsBlank(DeliverDateTo_2.Value), DatePicker3_3.Value, DeliverDateTo_2.Value))
)

)
 
 
 
 
Note : the lookup method is been used in my code so that every time and every filter  - the first record to be selected.  Till I was applying only sort by date, it was working fine - The filter was getting applied and was always selecting the first record ,
BUT when I added another column for sort, the problem starter of not bring the correct result
Categories:
I have the same question (0)
  • Verified answer
    mmbr1606 Profile Picture
    14,615 Super User 2026 Season 1 on at

    hey @MIA27 

     

    can u try this:

    LookUp(
     SortByColumns(
     colAllWarranty,
     "cr333_claimdate", SortOrder.Descending,
     "cr333_claimno", SortOrder.Ascending
     ),
     (Len(TypeModel_1.Value) = 0 || TypeModel_1.Value in MachineModel) &&
     (Len(TypeSerial_1.Value) = 0 || TypeSerial_1.Value in MachineSerial) &&
     (Len(TypeClaimNo.Value) = 0 || TypeClaimNo.Value in ClaimNo) &&
     (Len(TypeJobDesc_1.Value) = 0 || TypeJobDesc_1.Value in FailureDetails || TypeJobDesc_1.Value in OtherDetails) &&
     (
     (DateValue(ClaimDate) >= If(IsBlank(DeliverFromDate_2.Value), DatePicker3_2.Value, DeliverFromDate_2.Value)) &&
     (DateValue(ClaimDate) <= If(IsBlank(DeliverDateTo_2.Value), DatePicker3_3.Value, DeliverDateTo_2.Value))
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard