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

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,605 Super User 2025 Season 2 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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard