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 Apps
Answered

Sort by two colums

(0) ShareShare
ReportReport
Posted on by 49

Hi,

 

I have two buttons above the gallery. One sets the SortDatum value and the other sets SortFehlerDatum. Why in this case does sorting work for the first value Datum?

How could I make it sort by both values?

 

 

 

SortByColumns(
 Filter(
 DataFB,
 And(
 Or(
 IsBlank(dpStartDate.SelectedDate),
 Datum >= dpStartDate.SelectedDate
 ),
 Or(
 IsBlank(dpEndDate.SelectedDate),
 Datum <= dpEndDate.SelectedDate
 ),
 Bauteile.Value = varBauteile
 )
 ),
 "Datum",
 If(
 SortDatum,
 SortOrder.Descending,
 SortOrder.Ascending
 ),
 "FehlerBild",
 If(
 SortFehlerBild,
 SortOrder.Descending,
 SortOrder.Ascending
 )
)

 

 

 

 

Categories:
  • Verified answer
    mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @ReeX 

     

    can you try this please:

    If(
     SortDatum,
     SortByColumns(
     Filter(
     DataFB,
     And(
     Or(
     IsBlank(dpStartDate.SelectedDate),
     Datum >= dpStartDate.SelectedDate
     ),
     Or(
     IsBlank(dpEndDate.SelectedDate),
     Datum <= dpEndDate.SelectedDate
     ),
     Bauteile.Value = varBauteile
     )
     ),
     "Datum",
     If(
     SortOrderToggle, // Assume SortOrderToggle is a toggle for ascending/descending
     SortOrder.Descending,
     SortOrder.Ascending
     )
     ),
     SortByColumns(
     Filter(
     DataFB,
     And(
     Or(
     IsBlank(dpStartDate.SelectedDate),
     Datum >= dpStartDate.SelectedDate
     ),
     Or(
     IsBlank(dpEndDate.SelectedDate),
     Datum <= dpEndDate.SelectedDate
     ),
     Bauteile.Value = varBauteile
     )
     ),
     "FehlerBild",
     If(
     SortOrderToggle, // Reuse the same toggle or use another one if different sorting orders are needed
     SortOrder.Descending,
     SortOrder.Ascending
     )
     )
    )
    

     

    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

  • ReeX Profile Picture
    49 on at

    hey @mmbr1606 

     

    what is SortOrderToggle? 

     

     

  • Sanshubhs Profile Picture
    98 on at
    SortByColumns(
     Filter(
     DataFB,
     And(
     Or(
     IsBlank(dpStartDate.SelectedDate),
     Datum >= dpStartDate.SelectedDate
     ),
     Or(
     IsBlank(dpEndDate.SelectedDate),
     Datum <= dpEndDate.SelectedDate
     ),
     Bauteile.Value = varBauteile
     )
     ),
     If(
     SortDatum,
     "Datum",
     "FehlerBild"
     ),
     If(
     varSort,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

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 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard