cancel
Showing results for
Did you mean:
Frequent Visitor

## Independent filtering and sorting of a Gallery

Hi,

I want to filter and sort my gallery.

My filter options are: All, Having comment, Being Overdue,  Having follow up date. The chosen option is put into a variable FilterVar

Also I want to sort: Invoice date, Due date, Amount, Follow up date. The chosen option is put into a variable SortVar

From my mathematical understanding there are 16 combinations.

My idea was to first apply the filter statement to the item gallery and then as a chained command the sort statement

If(FilterVar=1; Sammlung2; If(FilterVar=2; Filter(Sammlung2; !IsBlank(Bemerkung)); If(FilterVar=3; Filter(Sammlung2; Delta>14))));; Sorting...

But this does not work.

I understand that I could use nested filtering and sorting. However, this would be a very big expression (16 combinations).

Any ideas, how to make this happen in a nice way?

Thx Christian

1 ACCEPTED SOLUTION

Accepted Solutions
Resident Rockstar

Your approach is a bit off.

Try something like this:

``````SortByColumns(
Filter(
Sammlung2
,Or(
FilterVar = 1
,And(FilterVar = 2, !IsBlank(Bemerkung))
,And(FilterVar=3, Delta>14)
)

)
, SortVar
, Ascending
)``````

Hope this helps you solve this.

Paul

4 REPLIES 4
Community Support

Hi,

The only way I can think of is the nesting solution way. I would give that a try and if it doesn't work for you I would consider opening a ticket with Microsoft Support. Unfortunately it is fairly uncommon that someone wants to filter as much as you. I will include a link below; on how to open a ticket with Microsoft Support. Otherwise if any other communities members might know feel free to chime in.

If you would like to create a ticket with Microsoft Customer Support here is a link on how to do so: https://docs.microsoft.com/en-us/power-platform/admin/get-help-support

Regards,

Alex

-------

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Resident Rockstar

Resident Rockstar

Your approach is a bit off.

Try something like this:

``````SortByColumns(
Filter(
Sammlung2
,Or(
FilterVar = 1
,And(FilterVar = 2, !IsBlank(Bemerkung))
,And(FilterVar=3, Delta>14)
)

)
, SortVar
, Ascending
)``````

Hope this helps you solve this.

Paul

Frequent Visitor

Hi Paul,

great, I did not know the SortByColumn function which allows for filtering and sorting independently. This is what I needed 🙂

Thx Chris

Announcements

#### Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

#### Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

#### European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

#### Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,980)