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 / Easy Syntax question
Power Apps
Answered

Easy Syntax question

(0) ShareShare
ReportReport
Posted on by 356

Getting an error with following syntax but can't figure out where my error is.  Any help would be much appreciated.

 

SortByColumns

          (If

                (ddLevelSelector.SelectedText.Value= "All Levels", Interventions,
                Filter(Interventions, ddLevelSelector.SelectedText.Value=ConcernLevel,
"ReferralDate", Descending, "LastName", Ascending, "LastName", Ascending
)
)

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @slhangen 

    Please consider changing your Formula to the following:

    SortByColumns
     Filter(Interventions, 
     (ddLevelSelector.SelectedText.Value= "All Levels" || ddLevelSelector.SelectedText.Value=ConcernLevel)
     ),
     "ReferralDate", Descending, 
     "LastName", Ascending, 
     "LastName", Ascending
    )

    Also, you should replace the SelectedText properties in your formula as it is a deprecated property.

     

    I hope this is helpful for you. 

  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @slhangen ,

    Do you want to display “Interventions” when ddLevelSelector.SelectedText.Value= "All Levels" , otherwise display the results of Filter(Interventions, ddLevelSelector.SelectedText.Value=ConcernLevel) ?

    If yes, maybe you place the “)” in a wrong location.

    Also, if ConcernLevel is one of the choices from ddLevelSelector, you should use ddLevelSelector.SelectedText.Value=”ConcernLevel” in Filter() as a condition.

    You can try below formula:

    SortByColumns
     (If
     (ddLevelSelector.SelectedText.Value= "All Levels", Interventions,
    
     Filter(Interventions, ddLevelSelector.SelectedText.Value=”ConcernLevel”)) 
    
    "ReferralDate", Descending, "LastName", Ascending, "LastName", Ascending
    )

    Best Regards,

    Allen

  • slhangen Profile Picture
    356 on at

    Works perfectly!  Been fighting this for weeks.

     

    Thanks again!!!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @slhangen 

    In general, it is not good practice to put If statements to select two (or more) datasources.  In your case you are taking the suggestion of @v-albai-msft which uses this method.  

    Take a look at the formula I provided as it avoids this bad practice.

     

    And..for your weeks of fighting...hit up the forums as soon as you start to struggle.  Plenty of minds here that will get you on the right course and save you some time. 😁

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard