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 and Sort with S...
Power Apps
Answered

Filter and Sort with Switch Datasource

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone!


Background:

I have a form to allow users to provide an update to their current goal status. I would like to show them the history of their updates next to the form.


The goals are held in a single sharepoint list for all regions, and the status updates are housed in a seperate list for each region with an ID to match the goals to the status. (Less than ideal, but I would run into delegation limits otherwise)


_regionTracker: variable that is holding the selected region.

GoalStatusLink: Column in all lists that links the statuses to the goals.

GoalStatusLinkLabel: A label displaying the current goal record being viewed.


Issue:

Using Switch to select a datasource is working for write locations, but in the below formula, it is not working for display. To test, I removed the switch for a static datasource and the expected results are displayed.

 

Sort(
 	Filter(
 		Switch(
 			_regionTracker,
 			"Region1",
 			'Region 1 Status',
 			"Region 2",
 			'Region 2 Status'
//and so on and so on and so on ), GoalStatusLink = GoalStatusLinkLabel.Text ), Date, Descending )

 Am I overlooking something obvious here?

 

Thanks in advance!

 

/Gary

Categories:
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    I carried out a test on my side and I am not able to reproduce the error/issue. Can you share more details? Also, make sure that the _regionTracker variable has the value which you are looking for, you can either check this in the Variables or print it on a test label.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your reply @yashag2255!

     

    My variable is carrying the correct value for the switch criteria to work (it's being used in more than one place).

     

    When the switch formula is in place, I am seeing issues highlighted against this line:

     

    GoalStatusLink                =           GoalStatusLinkLabel.Text

    ^Name isn't valid            ^Invalid arguement type

     

    These issues are not present when using a single sharepoint list as a datasource.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The answer seems to be that, frustratingly, one of my many lists has the column 'data type' as number and the others as text. After correcting this, the formula is working as expected.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    hey @Anonymous 

     

    Glad that it is resolved now. If this issue is resolved, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard