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 / Switch Filter not working
Power Apps
Answered

Switch Filter not working

(0) ShareShare
ReportReport
Posted on by 1,512

For some reason my brain is drawing a blank on this.

 

I have this code

If(Filter('Asset Photos*DO NOT USE',Substation.Value = Gallery4_23.Selected.Substation && AssetClass = "Circuit Switcher" && AssetPosition= Gallery4_23.Selected.'Asset Location')

However, that only works great if I have one Asset Class to reference.  In my case I have 3 I need to have switch between.

Switch(
 Subtitle2_213.Text,
 "CT",
 Filter('Asset Photos*DO NOT USE',Substation.Value = Gallery4_23.Selected.Substation && AssetPosition= Gallery4_23.Selected.'Asset Location'),
 "PT",
 Filter('Asset Photos*DO NOT USE',Substation.Value = Gallery4_23.Selected.Substation && AssetPosition= Gallery4_23.Selected.'Asset Location'),
 "CCVT",
 Filter('Asset Photos*DO NOT USE',Substation.Value = Gallery4_23.Selected.Substation && AssetPosition= Gallery4_23.Selected.'Asset Location')
 
 )

 

I know this code is not correct for the most part because it is not recognizing the Substation or the Asset Class, I am missing something.

 

I always struggle with the syntax with a Switch.

Thanks in advance for the assistance.

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     

    From your code snippet it looks like you are filtering based on the selected gallery record. Are you selecting a new gallery record when your switch condition (Subtitle2_213) changes? If you don't select a new gallery record it will filter by the same criteria every time.

     

    Thanks,

    Theodore

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Your switch formula contains the same result for every outcome listed in it, if that is the case you would not need a switch at all. What errors do you receive if you put only this

    Filter(
    'Asset Photos*DO NOT USE',
    Substation.Value = Gallery4_23.Selected.Substation 
    && 
    AssetPosition= Gallery4_23.Selected.'Asset Location')

    Maybe upload a screenshot so I can get a better idea what is going on

  • Dorinda Profile Picture
    1,512 on at

    I don't get any error what I get is too much information back it is not recognizing the I only want CCVT and not Transformers

    See image below this is showing too many items.

    Dorinda_0-1666382459275.png

    Compared to what is supposed to be showing

    Dorinda_1-1666382496107.png

     

  • Verified answer
    Dorinda Profile Picture
    1,512 on at

    I got this working Thanks @TheRobRush  for the push in the right direction.

    Filter('Asset Photos*DO NOT USE',Substation.Value = Gallery4_23.Selected.Substation && AssetClass = Gallery4_23.Selected.'Asset Class' && AssetPosition= Gallery4_23.Selected.'Asset Location')

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard