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 / Filter problem with St...
Power Apps
Answered

Filter problem with StartWith

(0) ShareShare
ReportReport
Posted on by 648

Hello 

I am trying to filter my sharepoint listbox and i need it to 

First select my schoolidnr  ( Kostnadsställe="1003" ) i works and when i use 

Filter( tblProgram; StartsWith(Program; "E") Or StartsWith(Program; "S")).Program it works 

 

But mixing them no good result , my wish is to see programs with name starting on E or S only in shool nr 1003 

 

This is one of lots of combos i have trying with no good result , is it possible to make this filter 

Filter(tblProgram;Kostnadsställe="1003") && Filter(tblProgram; Or StartsWith(Program; "E" Or StartsWith(Program; "S")).Program

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hi @dalacarelia_196 ,

     

    Try the filter below - some suggestions on the way I would approach it (and there are obviously other solutions):-

    • Bracket the Or items if they have to operate in conjunction with And
    • You can use || instead of Or
    • You do not need && - a comma in filter infers And
    • I have used commas as delimiters
    • I have trimmed the StartsWith statements down a bit

    Filter(
         tblProgram,

         Kostnadsställe="1003",

         (

         StartsWith(Program, "E") ||

         StartsWith(Program, "S")

         )

    )

  • dalacarelia_196 Profile Picture
    648 on at

    Thanks this saves time for me i am so happy 4 this excelent solution 🙂

     

  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    You are welcome  - happy to help

  • dalacarelia_196 Profile Picture
    648 on at

    Hello again sir 

    If i want the result of the program search to be A-Z or Z-A where to put the ;Ascending or Desc

     

    Filter(
         tblProgram;
         Skola=ddskola.SelectedText.Value;
         (
         StartsWith(Program; "E") ||
         StartsWith(Program; "V")
         )
    )

     

     

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Hi,

    Would suggest creating a new thread for a new question. Here is a suggested approach.

    You can use Sort or SortByColumns. Here is an example:

    SortByColumns(
    Filter(tblProgram; Skola=ddskola.SelectedText.Value: (StartsWith(Program; "E") || StartsWith(Program; "V"))), "Program", If(SortOrderVariable, Ascending, Descending))

    SortOrderVariable can be a context variable that toggles between true and false when the user clicks on the Sort icon.
    UpdateContext({SortOrderVariable:!SortOrderVariable})

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Hardit Bhatia
    The Power Addict
    https://thepoweraddict.com
  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hi @dalacarelia_196 ,

    @PowerAddict was too quick for me here.

    My response is almost exactly the same - I tend to prefer Sort if it works. Also toggle button is exactly what I use (I call it vSort).

     

    Sort(

         Filter(
              tblProgram,
              Skola=ddskola.SelectedText.Value,
             (
              StartsWith(Program, "E") ||
              StartsWith(Program, "V")
              )
         ),

         If(
              vSort,

              Ascending,

              Descending

         )
    )

  • dalacarelia_196 Profile Picture
    648 on at

    Hello

     

    If i understod  this right so i need a trigger 4 the sorting , is it not possible to force it to desc or asc

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    If you want either Ascending or Descending (and not both) you can do:

    SortByColumns(
    Filter(tblProgram; Skola=ddskola.SelectedText.Value: (StartsWith(Program; "E") || StartsWith(Program; "V"))), "Program", Ascending)

    Let me know if this helps.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Hardit Bhatia
    The Power Addict
    https://thepoweraddict.com
  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hi @dalacarelia_196 ,

     

    Absolutely - I just over-read it a bit

    Sort(

         Filter(
              tblProgram,
              Skola=ddskola.SelectedText.Value,
             (
              StartsWith(Program, "E") ||
              StartsWith(Program, "V")
              )
         ),

              Ascending

    )

  • dalacarelia_196 Profile Picture
    648 on at

    Little confused about the colon 

     

    Skola=ddskola.SelectedText.Value:

     

    I am from sweden and we are using ; instead of , crazy but life is like that for us . 

    Is it ; is : instead of lie the OR with parallell signs

    Skola=ddskola.SelectedText.Value;

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard