Skip to main content

Notifications

Community site session details

Community site session details

Session Id : K8/MzoCiJ+NOL5Ff8sx0Gm
Power Apps - Building Power Apps
Answered

Formula Help (Starts With & Filters)

Like (0) ShareShare
ReportReport
Posted on 21 Jun 2021 08:25:00 by 70

Good Morning, 

I'm struggling with a formula for my Gallery and I was hoping somebody here could assist me. Formula is as follows;

 

SortByColumns(
StartsWith("Medical",'Appointment Type',
Filter('CarePlan Appointment Log',
('Date of Appointment' >= 'Start Date_1'.SelectedDate) && ('Date of Appointment' <= 'End Date_1'.SelectedDate),
CustomID = VarEmpID)),
"Created", Ascending)

The SharePoint List will easily have a few thousand entries so I know it needs to begin with 'StartsWith' to avoid delegation issues, but from the matching rows it brings into the PowerApp, I then need it to filter based on a CustomID column and to 2 Date Selectors as criteria. 

I'm not too sure where I'm going wrong with this formula. 

Thanks

Categories:
  • Axeum Profile Picture
    70 on 21 Jun 2021 at 12:09:29
    Re: Formula Help (Starts With & Filters)

    Thank you @WarrenBelz You're a life saver

  • ganeshsanap Profile Picture
    1,551 on 21 Jun 2021 at 11:41:35
    Re: Formula Help (Starts With & Filters)

    @WarrenBelz Exactly, syntax of StartsWith is: 

     

    StartsWith( Text, StartText )

     

    This is what I have written in my answer above.

     

    But I think @Axeum didn't try my answer/suggestion yet 😄

     

    Microsoft documentationEndsWith and StartsWith functions in Power Apps 


    Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

     

    Best Regards,

    Ganesh Sanap

    Blog site 

  • Verified answer
    WarrenBelz Profile Picture
    146,645 Most Valuable Professional on 21 Jun 2021 at 11:37:29
    Re: Formula Help (Starts With & Filters)

    Hi @Axeum ,

    I just noticed your StartsWith() is the wrong way around - should be

    StartsWith(
     'Appointment Type',
     "Medical"
    ) 

    This is fully Delegable (as is the rest of your statement although you had a comma in the wrong place).

    SortByColumns(
     Filter(
     'CarePlan Appointment Log',
     StartsWith(
     'Appointment Type',
     "Medical"
     ) &&
     'Date of Appointment' >= 'Start Date_1'.SelectedDate &&
     'Date of Appointment' <= 'End Date_1'.SelectedDate &&
     CustomID = VarEmpID
     ),
     "Created"
    )
    

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Axeum Profile Picture
    70 on 21 Jun 2021 at 10:15:47
    Re: Formula Help (Starts With & Filters)

    Sorry Warren, 

    With the filter aspect going first, it's coming up with the delegation problem on the StartsWith.


    Axeum_0-1624270524122.png

     

  • Axeum Profile Picture
    70 on 21 Jun 2021 at 10:11:41
    Re: Formula Help (Starts With & Filters)

    Hello all, 

    Perhaps I need to start my problem with more clarity. 

    I have a SharePoint List that I know will contain a minimum of 10,000 rows. Thus, I need a formula that avoids all delegation problems. 

    I know that using 'Filter(Source, Logical Test)' pulls in as much of the source as it can (Rows 1-2000) and then applies the logical test on those rows but 10,000 rows this isn't useful, especially since the newer (More important) data will be at the bottom entries. 

    The only other option I know of is using 'StartsWith(Text, Start)' but this has proven problematic since it has no Source in its requirements. 

    I've been using 'SortByColumns(Source,Column)' as I have done in all my other Galleries and hoped that using this Source, I could then go into a 'StartWith' but I've not been able to make that work either. 

    My current formula (thanks to earlier help) is;

    SortByColumns(
    Filter('CarePlan Appointment Log',
    StartsWith( "Medical",'Appointment Type') &&
    'Date of Appointment' >= 'Start Date_1'.SelectedDate &&
    'Date of Appointment' <= 'End Date_1'.SelectedDate &&
    CustomID = VarEmpID
    ),"Created")

    Ideally... I need a formula that goes. 

    SortByColumns(Source
    StartWith(Appointment Type = Medical & CustomID = VarEMPID),
    //Of this selection
    Filter(Between Start&End Date),
    Descending Date Order)


    Any help in resolving this would be great

  • WarrenBelz Profile Picture
    146,645 Most Valuable Professional on 21 Jun 2021 at 09:47:02
    Re: Formula Help (Starts With & Filters)

    Hi @Axeum ,

    StartsWith is fully Delegable, so there are no issues there. Dates are now also Delegable (or so it seems), so your formula should work without any issues.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Axeum Profile Picture
    70 on 21 Jun 2021 at 08:42:07
    Re: Formula Help (Starts With & Filters)

    Thank You!

    The formula works but with 'StartWith' taking place after the 'Filter' will I not be hit with the delegation issues?

    From memory, Filters pulls in the first 2000 rows from a source and filters that, whilst 'StartWith' searches the source and only pulls in the first 2000 relevant rows. 

  • ganeshsanap Profile Picture
    1,551 on 21 Jun 2021 at 08:40:14
    Re: Formula Help (Starts With & Filters)

    @Axeum  Try using this formula: 

     

     

    SortByColumns(
    	Filter(
    		'CarePlan Appointment Log',
    		StartsWith('Appointment Type', "Medical") && 'Date of Appointment' >= 'Start Date_1'.SelectedDate && 'Date of Appointment' <= 'End Date_1'.SelectedDate && CustomID = VarEmpID
    	),
    	"Created", Ascending
    )

     

     

    Considering column name is Appointment Type.


    Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

     

    Best Regards,

    Ganesh Sanap

    Blog site 

  • WarrenBelz Profile Picture
    146,645 Most Valuable Professional on 21 Jun 2021 at 08:37:39
    Re: Formula Help (Starts With & Filters)

    Hi @Axeum ,

    Something like this should do it

     

    SortByColumns(
     Filter(
     'CarePlan Appointment Log',
     StartsWith(
     'Appointment Type',
     "Medical"
     ) && 
     'Date of Appointment' >= 'Start Date_1'.SelectedDate &&
     'Date of Appointment' <= 'End Date_1'.SelectedDate &&
     CustomID = VarEmpID
     ),
     "Created"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard